#!/bin/sh
#
# pbsmom: This script will start and stop the PBS mom
#
# description: PBS is a batch versitle batch system for SMPs and clusters
#
### BEGIN INIT INFO
# Provides: pbsmom
# Required-Start: $network  $remote_fs
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start PMB MOM
### END INIT INFO      

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

# First reset status of this service
rc_reset    

case "$1" in
  start) 
	echo -n "Starting PBS Mom"
	startproc /opt/pbs/sbin/pbs_mom 
	rc_status -v
  ;;
  stop)
	echo -n "Stopping PBS Mom"
	killproc -TERM  /opt/pbs/sbin/pbs_mom 
	rc_status -v
  ;;
  try-restart)
	$0 status >/dev/null &&  $0 restart
				     
        # Remember status and be quiet
        rc_status
  ;;	
  status)
        echo -n "Checking for PBS mom: "
	checkproc /opt/pbs/sbin/pbs_mom  
	rc_status -v
  ;;
  restart)
	echo "Restarting PBS Mom"
	$0 stop
	$0 start
	rc_status
  ;;
  *)
        echo "Usage: $0 {start|stop|status|restart|try-restart}"
        exit 1
esac
rc_exit
