Ubuntu18添加开机启动项
作者:互联网
因为ubuntu18已经没有用rc.local,因为日常用的习惯所以我们下面进行创建
1.创建rc.local软链接(因为system只会读取/etc/systemd/system下的文件)
ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
2.修改/lib/systemd/system/rc-local.service文件
[Install] WantedBy=multi-user.target #运行级别 Alias=rc-local.service
3.创建rc.local
touch /etc/rc.local chmod 755 /etc/rc.local #添加权限
4. vi /etc/rc.local
#!/bin/sh -e#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
cd /opt/phphome/zdtp
./zdtpServer &
cd /opt/phphome/pm1
./pm1Server &
cd /opt/phphome/beijing
./BJServer &
exit 0
标签:systemd,service,system,etc,启动项,Ubuntu18,rc,开机,local 来源: https://www.cnblogs.com/sankye/p/15527446.html