#!/bin/sh # # short service description # # chkconfig: 345 # # description: long service description # # $Id$ # 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 -a "$1" != stop -a "$1" != status ]; then msg_network_down exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/ ]; then msg_starting daemon /usr/sbin/ RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ else msg_already_running fi } stop() { if [ -f /var/lock/subsys/ ]; then # Stop daemons. msg_stopping killproc killproc --pidfile /var/run/.pid -TERM rm -f /var/lock/subsys/ else msg_not_running fi } reload() { if [ -f /var/lock/subsys/ ]; then msg_reloading killproc -HUP killproc --pidfile /var/run/.pid -HUP RETVAL=$? else msg_not_running RETVAL=7 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) reload ;; # ONLY if program allows reloading without stopping # otherwise include force-reload with 'reload' force-reload) restart ;; status) status RETVAL=$? ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL