日期:2014-05-16 浏览次数:20706 次
#!/bin/sh
# chkconfig: 2345 80 50
# description: myTestService is for testing how to write service in Linux
# processname: myTestService
# Source function library.
. /etc/rc.d/init.d/functions
tsd=${TSD-/usr/bin/tsd}
prog=tsd
pidfile=${PIDFILE-/var/run/tsd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/tsd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
start() {
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $tsd
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $tsd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status -p ${pidfile} $tsd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $ret