Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 13b2219f8e4e68127910edbbac99b239 > files > 11

gated-3.6-5mdk.src.rpm

#!/bin/bash
#
# gated		This script is used to start/stop the gated routing
#		daemon
#
# chkconfig: 345 32 75
# description: Starts and stops gated (routing daemon). GateD is a modular \
#	software program consisting of core services, a routing database, \
#	and protocol modules supporting multiple routing protocols (RIP \
#	versions 1 and 2, DCN HELLO, OSPF version 2, EGP version 2 and BGP \
#	version 2 through 4)
# processname: gated
# pidfile: /var/run/gated.pid
# config: /etc/gated.conf

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

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

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

gdc=/usr/sbin/gdc
gated=/usr/sbin/gated
prog=gated

if [ ! -f /etc/gated.conf -o ! -f $gdc ] ; then
	action $"Not starting $prog: " true
	exit 0
fi

PATH=$PATH:/usr/bin:/usr/sbin

RETVAL=0

start() {
	echo -n $"Starting $prog: "
	daemon $gated
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/gated
	echo
	return $RETVAL
}

stop() {
	# Stop daemons.
	action $"Stopping $prog" $gdc stop
	RETVAL=$?
	if [ $RETVAL -eq 0 ] ; then
		rm -f /var/lock/subsys/gated
	fi
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	$gdc running
	RETVAL=$?
	;;
  reload)
	$gdc reconfig
	RETVAL=$?
	;;
  restart)
	$gdc restart
	RETVAL=$?
	;;
  restart)
	if [ -f /var/lock/subsys/gated ]; then
	    stop
	    start
	    RETVAL=$?
	fi
	;;
  *)
	echo $"Usage: $0 {start|stop|reload|restart|restart|status}"
	exit 1
esac

exit $RETVAL