Debian 9.x 解决 /etc/rc.local 开机启动没有的问题

149次阅读
没有评论

共计 543 个字符,预计需要花费 2 分钟才能阅读完成。

在程序部署中,我们会遇到某些软件并没有附加到系统服务中,无法通过systemctl或者service来控制开机自启,所以一些脚本中,我都是推荐添加启动命令到 /etc/rc.local 文件中,但是 Debian 9非常奇葩, 默认不带 /etc/rc.local 文件,但是却没阉割掉rc.local 服务,所以我们需要补齐缺失的文件。

cat > /etc/systemd/system/rc-local.service <

因为rc.local文件丢失,我们需要手工添加一个 /etc/rc.local文件:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

然后赋予权限:

chmod +x /etc/rc.local
systemctl start rc-local.service
正文完
 
admin
版权声明:本站原创文章,由 admin 2019-10-11发表,共计543字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码