Ubuntu 18.04 rc.local 设置开机自启动

Ubuntu 18.04 rc.local 设置开机自启动

Ubuntu 18.04默认进程启动管理已经切换至systemd,不在使用SysV。如果想像之前一样使用/etc/rc.local设置开机自启动,请如下设置修改rc-local.service/lib/systemd/system/rc-local.service新增:[Install]WantedBy=multi-user.targetAlias=rc-local.s...

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
原文链接:https://www.vipiu.net/archives/2019/09/07/2476.html,转载请注明出处。
0

评论0

请先

会员低至49元,开通享海量VIP资源免费下载 自助开通
显示验证码
没有账号?注册  忘记密码?