centos7将指定脚本命令添加到系统自启动

场景:有时候有些我们安装的服务并不能像Apache等服务可以直接添加到开机自启动,所以我们需要手动添加一下

我这里使用的是脚本添加

vim /etc/init.d/xampp_auto_start.sh               将命令启动项添加到新建的脚本中

我在第一次创建xampp_auto_start.sh 时,并没有写

#chkconfig:345 95 95
#description:xampp_server

此时 当添加该脚本到系统自启动时会告诉我们不支持

写上后保存退出  执行如下命令

chkconfig xampp_auto_start.sh --add

chkconfig xampp_auto_start.sh on

然后reboot 重启

 

 这是可以看到服务已经开机自启动了,完成!

猜你喜欢

转载自blog.csdn.net/qq_28519183/article/details/89202004