#!/bin/sh # torque.setup # USAGE: torque.setup [] if [ "$1" = "" ] ; then echo "USAGE: torque.setup " exit 1 fi if [ "$2" = "" ] ; then # obtain name obtained from reverse lookup of ip address HOSTNAME=`perl -e "print +(gethostbyname(\"$(hostname)\"))[0]"` else HOSTNAME=$2 fi # enable operator privileges USER=$1@$HOSTNAME echo "initializing TORQUE (admin: $USER)" ps -ef | grep -v grep | grep pbs_server if [ "$?" -eq "0" ] ; then echo "ERROR: pbs_server already running... run 'qterm' to stop pbs_server and rerun" exit 1; fi pbs_server -t create # We need to pause a second to allow the server to finish coming # up. sleep 2 ps -ef | grep -v grep | grep pbs_server if [ "$?" -ne "0" ] ; then echo "ERROR: pbs_server failed to start, check syslog and server logs for more information" exit 1; fi echo set server operators += $USER | qmgr if [ "$?" -ne "0" ] ; then echo "ERROR: cannot set TORQUE admins" qterm exit 1; fi echo set server managers += $USER | qmgr qmgr -c 'set server scheduling = true' qmgr -c 'set server keep_completed = 300' qmgr -c 'set server mom_job_sync = true' # create default queue qmgr -c 'create queue batch' qmgr -c 'set queue batch queue_type = execution' qmgr -c 'set queue batch started = true' qmgr -c 'set queue batch enabled = true' qmgr -c 'set queue batch resources_default.walltime = 1:00:00' qmgr -c 'set queue batch resources_default.nodes = 1' qmgr -c 'set server default_queue = batch'