#!/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 test -f /etc/rc.d/init.d/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 for SLEEP in 2 4 6 8 10 ; do $PBS_DAEMON -d $PBS_HOME -t create -f & sleep $SLEEP $BIN_PATH/qterm done if [ -r $PBS_SERVERDB ]; then success RET=0 else failure RET=1 fi } start() { status pbs_server >/dev/null 2>&1 if [ $? -eq 0 ]; then echo "pbs_server is already running." exit 0 fi 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: " $BIN_PATH/qterm RET=$? if [[ $RET -ne 0 ]]; then killproc pbs_server -TERM RET=$? fi rm -f /var/lock/subsys/pbs_server echo } reload() { echo -n "Reloading pbs_server: " killproc pbs_server -HUP RET=$? echo } # customize these to match your settings SBIN_PATH=@sbindir@ BIN_PATH=@bindir@ PBS_DAEMON=$SBIN_PATH/pbs_server PBS_HOME=@PBS_HOME@ PBS_ARGS="" PBS_SERVERDB="$PBS_HOME/server_priv/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