Home » Linux » Ubuntu18.04设置开机自动启动

一、/lib/systemd/system/rc.local.service增加install字段

[Install]  
WantedBy=multi-user.target  
Alias=rc-local.service

二、新建/etc/rc.local

#!/bin/sh -e
#
# rc.local

/xxx/xxx start

exit 0

三、设置rc.local可执行权限

sudo chmod +x /etc/rc.local

四、创建软链接

ln -s /lib/systemd/system/rc.local.service /etc/systemd/system/

五、启动服务检查服务状态

sudo systemctl enable rc-local
sudo systemctl start rc-local.service

六、检查服务状态

sudo systemctl status rc-local.service

标签: Ubuntu 开机自动启动 rc.local.service rc.local

添加新评论

V