#!/bin/sh
#
# pbs_mom	This script will start and stop the TORQUE Mom
#
# chkconfig: 345 85 85
# description: TORQUE is a batch versatile batch system for SMPs and clusters
#
ulimit -n 32768
# Source the library functions
. /etc/rc.d/init.d/functions

PBS_PREFIX=/opt/pbs
PBS_HOME=/var/spool/pbs
OSCAR_CONFIG_OPTIONS=""
CONFIG_OPTIONS="-r $OSCAR_CONFIG_OPTIONS"

# let see how we were called
case "$1" in
	start) 
		gprintf "Starting TORQUE Mom: "
		daemon $PBS_PREFIX/sbin/pbs_mom $CONFIG_OPTIONS
		echo
		;;
	stop)
		gprintf "Shutting down TORQUE Mom: "
		killproc pbs_mom
		echo
		;;
	status)
		status pbs_mom
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
	        gprintf "Re-reading pbs_mom config file\n"
	        export pbs_mom_pid="`ps -axw |grep $PBS_PREFIX |grep -v grep|awk '{print $1}'`"
	        kill -SIGHUP $pbs_mom_pid
	        ;;
	*)
		gprintf "Usage: pbs_mom {start|stop|restart|reload|status}\n"
		exit 1
esac
