#!/bin/sh
#
# trqauthd	This script will start and stop the Torque Authorization Daemon
#
### BEGIN INIT INFO
# Provides:       trqauthd
# Required-Start: $syslog $remote_fs
# Should-Start:
# Required-Stop: $syslog $remote_fs
# Should-Stop: $null
# Default-Start:  2 3 5
# Default-Stop:
# Short-Description: Torque Authorization Daemon
# Description: Torque is a versatile batch system for SMPs and clusters.
#	Starts the Torque Authorization Daemon, which is used by the PBS server to
# authorize client connections.
### END INIT INFO

PBS_DAEMON=/usr/sbin/trqauthd
PBS_HOME=/var/spool/torque
export PBS_DAEMON

# Source the library functions
. /etc/rc.status

[ -f /etc/sysconfig/trqauthd ] && . /etc/sysconfig/trqauthd
[ -x $PBS_DAEMON ] || exit

# let see how we were called
case "$1" in
	start) 
		echo -n "Starting TORQUE Authorization Daemon: "
		startproc $PBS_DAEMON
		rc_status -v
		;;
	stop)
		echo -n "Shutting down TORQUE Authorization Daemon: "
		killproc trqauthd
		rc_status -v
		;;
	status)
		checkproc trqauthd
		rc_status -v
		;;
	restart)
		$0 stop
		$0 start
		rc_status
		;;
	try-restart)
		$0 status >/dev/null && $0 restart
		rc_status
		;;
	reload|force-reload) 
		echo -n "Reloading TORQUE Authorization Daemon: "
		killproc trqauthd -HUP
		rc_status -v
		;;
	*)
		echo "Usage: trqauthd {start|stop|status|try-restart|restart|force-reload|reload}"
		exit 1
esac
rc_exit
