4725l6

Listing 6. Manipulating xauth to Display X Programs on the Private
Network

#/bin/ksh
#
# /etc/profile.d/pbsX.sh
#
# If PBS_ENVIRONMENT is set to PBS_INTERACTIVE and DISPLAY is set,
# mangle DISPLAY to point at the ssh pseudo-display on the front end's
# private interface and modify xauth accordingly.
if [ -n "$DISPLAY" -a "$PBS_ENVIRONMENT" == "PBS_INTERACTIVE" ]
then
    export DISPLAY=`echo $DISPLAY | sed 's/\.0//'`
    export AUTHKEY=`xauth list | grep $DISPLAY | sed "s/oscbw[0-9]*.osc.edu/node00.cluster.osc.edu/" | head -1`
    export DISPLAY=`echo $DISPLAY | sed 's/oscbw01/node00.cluster/'`
    xauth add $AUTHKEY
fi