initscripts/etc/rc.d/init.d/template
2011-04-26 12:26:24 +02:00

51 lines
920 B
Bash
Executable File

#!/bin/sh
#
# chkconfig: 2345 xx xx
# description: ...
. /etc/sysconfig/rc
. $rc_functions
NAME=service
DAEMON=/usr/sbin/$NAME
DAEMONPID=/var/run/$NAME.pid
DAEMONLOCK=/var/lock/subsys/$NAME
OPTIONS=
[ -x $DAEMON ] || exit 0
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
case "$1" in
start)
echo -n $"Starting"" $NAME: "
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
echo
;;
stop)
echo -n $"Stopping"" $NAME: "
killproc -p $DAEMONPID $DAEMON -TERM
echo
;;
reload)
echo -n $"Reloading"" $NAME: "
reloadproc $DAEMON
echo
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
condrestart)
[ -e "$DAEMONLOCK" ] && $0 restart || :
;;
status)
statusproc $DAEMON
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|reload|restart|force-reload|condrestart|status}"
exit 1
;;
esac