标签:自己的 status 服务 cti lse res init.d fun restart
#!/bin/bash. /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
rm -rf /var/lock/subsys/$SCRIPT_NAME
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
标签:自己的 status 服务 cti lse res init.d fun restart
原文地址:http://blog.51cto.com/14114496/2343680