Listing 1. PBS Job Prologue Script

#!/bin/csh
#
# /var/spool/pbs/mom_priv/prologue -- Create TMPDIR
#  on all the nodes
#
# prologue gets 3 arguments:
# 1 -- jobid
# 2 -- userid
# 3 -- grpid
setenv TMPDIR /tmp/pbstmp.$1
setenv USER $2
setenv GROUP $3
if ( -e /var/spool/pbs/aux/$1 ) then
  foreach node ( `cat /var/spool/pbs/aux/$1 | uniq` )
    rsh $node "mkdir $TMPDIR ; chown $USER $TMPDIR ;
    chgrp $GROUP $TMPDIR ;
    chmod 700 $TMPDIR" >& /dev/null
  end
else
  mkdir $TMPDIR
  chown $USER $TMPDIR
  chgrp $GROUP $TMPDIR
  chmod 700 $TMPDIR
endif