#!/bin/sh # # short service description # # chkconfig: 345 # # description: long service description # # $Id: template.init,v 1.8 2003/05/08 17:18:33 ankry Exp $ # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Set defaults OPTION1="" # Strings OPTION2="-q" # OPTION3= # Values OPTION4=5 # # Get service config - may override defaults [ -f /etc/sysconfig/ ] && . /etc/sysconfig/ # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network ]; then # nls "ERROR: Networking is down. %s can't be run." msg_network_down exit 1 fi else exit 0 fi # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/ ]; then # show "Starting %s service" msg_starting daemon RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ else # show "%s service is already running." msg_already_running exit 1 fi ;; stop) if [ -f /var/lock/subsys/ ]; then # Stop daemons. # show "Stopping %s service" msg_stopping killproc RETVAL=$? rm -f /var/lock/subsys/ else # show "%s service is not running." msg_not_running exit 1 fi ;; restart) $0 stop $0 start ;; reload) if [ -f /var/lock/subsys/ ]; then # show "Reload %s service" msg_reloading killproc -HUP RETVAL=$? else # show "%s service is not running." msg_not_running RETVAL=1 fi ;; force-reload) # if program allows reloading without stopping $0 reload # or if it doesn't $0 stop && $0 start ;; status) status RETVAL=$? ;; *) # show "Usage: %s {start|stop|restart|reload|force-reload|status}" msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 1 esac exit $RETVAL # This must be last line ! # vi:syntax=sh:tw=78:ts=8:sw=4