Ubuntu 18.04默认进程启动管理已经切换至systemd,不在使用SysV。如果想像之前一样使用/etc/rc.local设置开机自启动,请如下设置
修改rc-local.service
/lib/systemd/system/rc-local.service新增:
- [Install]
- WantedBy=multi-user.target
- Alias=rc-local.service
设置开机自启动rc-local
- systemctl enable rc-local
创建/etc/rc.local
- cat > /etc/rc.local << EOF
- #!/bin/bash
- echo "test rc.local " > /tmp/rctest.log
- EOF
新增执行权限
- chmod +x /etc/rc.local
Tue Feb 19 17:02:21 CST 2019