#!/bin/csh # typically, you put your scheduler directives here #SCHEDULE -CPUMINUTES 2764800 -MBYTES 28000 #SCHEDULE -CPUS HOSTS=1 PROCESSORS_PER_HOST=4 #SCHEDULE -JOBNAME PERSISTENT id=$$ ########################################################################## # if your prologue on the remote machine does not set up your X11 # environment, you can use xauth(1) to set it up. Depending on whether # you have temporary or permanent home directories, or have shared # file systems, this section will vary. Basically, you have to have your # X11 environment set up. setenv DISPLAY MYPC.aaaa.bbb.com:0 # assuming you use XAUTHORITY keys ... setenv XAUTHORITY $HOME/.Xauth.$id # output of "xauth -i list `hostname`" can be used to make this line xauth -i add $DISPLAY MIT-MAGIC-COOKIE-1 aabbccddeeff11223344556677889900 ########################################################################## # put screen(1) options here setenv CONFIG .screenrc.$id cat > $CONFIG <<\EOFSCREEN echo "#==============================================================================#" echo " NOTICE TO USERS " echo " " echo " This node is the property of IMAGINARY, Inc. It is for authorized use only. " echo " " echo "#==============================================================================#" echo " " # wait for carriage return sleep 2000 # disable the big copyright notice startup_message off # make utmp entries login on # autodetach on ####################### # correct some common problems with terminal definitions termcap vt100|xterm LP:G0 terminfo vt100|xterm LP:G0 termcap vt100 dl=5\E[M terminfo vt100 dl=5\E[M termcap xterm|fptwist ha@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l terminfo xterm|fptwist ha@:cs=\E[%i%p1%d;%p2%%dr:im=\E[4h:ei=\E[4l ####################### # switched ^a to (tab), so make ^a change region focus bind ^a focus ####################### \EOFSCREEN ########################################################################## setenv SNAME PERSISTENT_$$ setenv ESCAPE "^A\t" set term=xterm setenv SCREENDIR $HOME ########################################################################## setsid xterm -title "Persistent Remote xterm - `hostname`" -name PERSISTENT -e csh -c "screen -c $CONFIG" ########################################################################## @ COUNT = 1 while ( "$COUNT" < 86400 ) setenv DETACHED `screen -S $SNAME -list|grep -i Detached|wc -l|awk '{print $1}'` if ( "$DETACHED" > 0 ) then # recover detached session setsid xterm -title "Persistent Remote xterm - `hostname`" -name PERSISTENT -e csh -c "screen -c $CONFIG -R" sleep 10 else break endif screen -wipe @ COUNT =+ 1 ##########################################################################