新版本的debian 把rc.local 模式取消了。 有的时候还是自启动脚本比较有安全感,特别是一些零时需要随机启动的脚本。
重新配置一下吧

先创建一个文本

sudo vim /etc/systemd/system/rc-local.service

以下内容:

 [Unit] 
 Description=/etc/rc.local 
 Compatibility ConditionPathExists=/etc/rc.local 
 [Service] 
 Type=forking 
 ExecStart=/etc/rc.local start 
 TimeoutSec=0 
 StandardOutput=tty 
 RemainAfterExit=yes 
 SysVStartPriority=99 
 [Install] 
 WantedBy=multi-user.target


创建rc.local 文本

vim /etc/rc.local

用以下内容, 也可以马上加上自己的脚本

#!/bin/bash

设置一下权限

sudo chmod +x /etc/rc.local

激活

systemctl enable rc-local

搞定!