#!/bin/sh
#
# ypops		Init Script to start/stop ypops.
#
# chkconfig:	- 61 39
# description:	ypops
#
# processname: ypops
# config: /etc/ypops/ypopsrc
# pidfile: /var/run/ypops/ypops.pid

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

# Get network config
. /etc/sysconfig/network

test -f /etc/ypops/ypopsrc || exit 0

RETVAL=0

start() {
	gprintf "Starting ypops daemon: "
	daemon /usr/bin/ypops.sh 
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ypops		
	return $RETVAL
}

stop() {
	gprintf "Stopping ypops daemon: "
	killproc ypops
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/run/ypops/ypops.pid /var/lock/subsys/ypops
	return $RETVAL
}

restart() {
	stop
	start
}


case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status ypops
	;;
  restart)
	restart
	;;
  condrestart)
	[ -f /var/lock/subsys/ypops ] && restart || :
	;;
  *)
	gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0"
	exit 1
esac

exit $?

