設置自己的服務為自動重啟
阿新 • • 發佈:2019-01-17
art init bin stat top chkconfig 服務 service init.d #!/bin/bash
rm -rf /var/lock/subsys/$SCRIPT_NAME
action " stoping testsrv: " false
else
action " stoping testsrv: " false *)
echo service testsrv {start|stop|restart}
esac
description: testsrv
chkconfig: - 99 1
. /etc/init.d/functions
SCRIPT_NAME=testsrv
start(){
if [ -f /var/lock/subsys/$SCRIPT_NAME ];then
action " starting testsrv: "
else
touch /var/lock/subsys/$SCRIPT_NAME
action " starting testsrv: "
fi
}
stop(){
if [ -f /var/lock/subsys/$SCRIPT_NAME ];then
action " stoping testsrv: " false
else
action " stoping testsrv: " false
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
if [ -f /var/lock/subsys/$SCRIPT_NAME ];then
echo $SCRIPT_NAME is starting
else
echo $SCRIPT_NAME is stoping
fi
;;
echo service testsrv {start|stop|restart}
esac
設置自己的服務為自動重啟