Sophie

Sophie

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

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

#!/bin/sh
# chkconfig: - 56 56
# description: BGPv4, BGPv4+, BGPv4- routing daemon for use with Quagga
# processname: bgpd
# config: /etc/quagga/bgpd.conf
# pidfile: /var/lib/quagga/bgpd.pid

### BEGIN INIT INFO
# Provides:          bgpd
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:
# Default-Stop:
# Short-Description: Start bgpd at boot time
# Description:       Enable BGPv4 routing.
### 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=bgpd

# Config is a must to run
[ -f /etc/quagga/$ZNAME.conf ] || exit 0

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

start()
{
	is_yes "$NETWORKING" || return 0
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user quagga -- $ZNAME --daemon $BGPD_OPTS
	RETVAL=$?
	return $RETVAL
}

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

restart()
{
	$ZNAME --dryrun &>/dev/null
	RETVAL=$?
	if [ $[ $RETVAL > 0 ] == 1 ]; then
	    echo "Service $ZNAME is not restarted: config's test failed. Try '$ZNAME --dryrun'"
	    exit $RETVAL
	fi

	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