Debian 10和Debian 9一样,没有rc.local文件,导致我们有一些脚本无法设置开机启动,其实rc.local文件在debian 10里面默认没有启动而已。

输入命令:systemctl status rc-local,发现出现以下代码,没有启用

 rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/rc-local.service.d
           └─debian.conf
   Active: inactive (dead)
     Docs: man:systemd-rc-local-generator(8)

手动增加一个rc.local文件

nano /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

启动rc.local

systemctl start rc.local

发表评论

您的电子邮箱地址不会被公开。