root@iZm5e8p616e5848vln6s3gZ:~# 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: /lib/systemd/system/rc-local.service.d
└─debian.conf
Active: inactive (dead)
Condition: start condition failed at Sat 2018-11-10 18:01:27 CST; 34min ago
└─ ConditionFileIsExecutable=/etc/rc.local was not met 作者: fl20002 时间: 2018-11-10 18:42
首先,需要在debian9中开启开机自启服务,创建/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启动服务 这样,我们只需要将需要执行的命令写在/etc/rc.local的exit 0前面,就可以在开机后自动执行。作者: ChinaDNS 时间: 2018-11-10 18:44
https://sb.sb/blog/debian-9-rc-local/作者: binghe 时间: 2018-11-10 18:44
提示: 作者被禁止或删除 内容自动屏蔽作者: 3000 时间: 2018-11-10 18:52
原来是最头部必须加那个脚本类型声明。