#!/bin/sh # # pbs_server This script will start and stop the PBS Server # # chkconfig: 345 95 5 # description: PBS is a versatile batch system for SMPs and clusters # # Source the library functions . /etc/rc.d/init.d/functions create() { echo -n "Creating initial TORQUE configuration: " if [ -r $PBS_SERVERDB ]; then echo "Configuration already exists. Please remove $PBS_SERVERDB to create a new one." exit 1 fi $PBS_DAEMON -d $PBS_HOME -t create & while [ ! -r $PBS_SERVERDB ]; do sleep 1 done killproc pbs_server RET=$? } start() { status pbs_server >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "pbs_server is already running." exit 0 fi echo $PBS_SERVERDB if [ ! -r $PBS_SERVERDB ]; then create fi echo -n "Starting TORQUE Server: " daemon $PBS_DAEMON -d $PBS_HOME $PBS_ARGS RET=$? [ $RET -eq 0 ] && touch /var/lock/subsys/pbs_server echo } stop() { status pbs_server >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "pbs_server is not running." exit 0 fi echo -n "Shutting down TORQUE Server: " killproc pbs_server RET=$? rm -f /var/lock/subsys/pbs_server echo } reload() { echo -n "Reloading pbs_server: " killproc pbs_server -HUP RET=$? echo } PBS_DAEMON=/usr/local/sbin/pbs_server PBS_HOME=/var/spool/torque PBS_ARGS="" PBS_SERVERDB="$PBS_HOME/server_priv/serverdb" export PBS_DAEMON PBS_HOME PBS_ARGS PBS_SERVERDB if [ -f /etc/sysconfig/pbs_server ]; then . /etc/sysconfig/pbs_server fi # let see how we were called case "$1" in start) start ;; stop) stop ;; status) status pbs_server RET=$? ;; restart) stop start ;; reload) reload ;; create) create ;; *) echo "Usage: pbs_server {start|stop|restart|status|reload|create}" exit 1 esac exit $RET