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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐