#!/bin/sh
#
# pbs_sched	This script will start and stop the PBS Scheduler
#
# chkconfig: 345 95 5
# description: PBS is a batch versatile batch system for SMPs and clusters
#
# Source the library functions
. /etc/rc.d/init.d/functions

PBS_DAEMON=/usr/sbin/pbs_sched
export PBS_DAEMON

if [ -f /etc/sysconfig/pbs_sched ];then
   . /etc/sysconfig/pbs_sched
fi

# let see how we were called
case "$1" in
	start) 
		echo -n "Starting TORQUE Scheduler: "
		daemon $PBS_DAEMON
		RET=$?
		touch /var/lock/subsys/pbs_sched
		echo
		;;
	stop)
		echo -n "Shutting down TORQUE Scheduler: "
		killproc pbs_sched
		RET=$?
		rm -f /var/lock/subsys/pbs_sched
		echo
		;;
	status)
		status pbs_sched
		RET=$?
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload) 
		echo -n "Reloading pbs_sched: "
		killproc pbs_sched -HUP
		RET=$?
		echo
		;;
	*)
		echo "Usage: pbs_sched {start|stop|restart|status}"
		exit 1
esac
exit $RET
