Sophie

Sophie

distrib > Altlinux > 4.1 > i586 > media > core > by-pkgid > d93c745b4448496faf599ce9d9f18c5d > files > 17

quagga-0.99.18-alt0.M41.2.i586.rpm

#!/bin/sh
# chkconfig: - 57 55
# description: A Quagga watchdog
# processname: watchquagga
# config: /etc/sysconfig/quagga
# pidfile: /var/lib/quagga/watchquagga.pid

### BEGIN INIT INFO
# Provides:          watchquagga
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:
# Default-Stop:
# Short-Description: Start bgpd at boot time
# Description:       Enable watchdog for Quagga's daemons.
### END INIT INFO

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
SourceIfNotEmpty /etc/sysconfig/network

# quagga command line options
SourceIfNotEmpty /etc/sysconfig/quagga

ZNAME=watchquagga

# Check that there are daemons to be monitored.
[ -z "$WATCH_DAEMONS" ] && exit 0

RETVAL=0
PIDFILE=/var/lib/quagga/$ZNAME.pid
LOCKFILE=/var/lock/subsys/$ZNAME

start()
{
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- $ZNAME --daemon $WATCH_OPTS $WATCH_DAEMONS
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- $ZNAME
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  reload|restart)
	restart
	;;
  condstop)
	# Stop the servce if it is already running
	if [ -e "$LOCKFILE" ]; then
	 stop
	fi
	;;
  condrestart|condreload)
	# Restart the servce if it is already running
	if [ -e "$LOCKFILE" ]; then
 	 restart
	fi
	;;
  status)
	# report the status of the daemons in free-form format
	status --pidfile "$PIDFILE" --expect-user quagga -- $ZNAME
	RETVAL=$?
	;;
  *)
	msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
	RETVAL=1
esac

exit $RETVAL