debian 添加开机启动命令
debian默认没有这个文件,并且服务是关闭的
创建/etc/rc.local,并写入内容
1 |
vim /etc/rc.local |
1 2 3 4 5 6 7 |
#!/bin/bash # 要执行的命令 或 脚本 # /etc/init.d/cups restart # /etc/init.d/apparmor restart # /etc/init.d/apparmor reload exit 0 |
接着赋予执行权限
1 2 |
<span class="token function">chmod</span> a+x /etc/rc.local |
重启rc.local服务
1 |
systemctl restart rc.local |
此时将要开机执行的命令添加到/etc/rc.local中exit 0的上面即可