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
上一篇:使用systemctl管理服务(nginx)


下一篇:性能压测-压力测试与监控