分类:随笔 日期:2020-10-21 作者:caocaofff 浏览:221
这里举例你的服务名是test
#创建服务文件
vim /etc/init.d/test
chmod a+x /etc/init.d/test
以下是test内容
#! /bin/sh
. /lib/lsb/init-functions
case "$1" in
start)
'/home/test.sh start'
exit 0
;;
stop)
'/home/test.sh stop'
exit 0
;;
*) echo 'require start|stop'
exit 1
;;
esac
#重新加载服务
systemctl daemon-reload
#设置开机启动
systemctl enable test.service
版权属于:caocaofff(除特别注明外)
本文链接:https://cboot.org/post/114.html
本站文章采用 知识共享署名4.0 国际许可协议 进行许可,请在转载时注明出处及本声明!