#!/usr/bin/env pagsh screen=`which screen` # Check for pre-existing screens. screenlist=`$screen -list | grep owl` if [ "x$screenlist" != "x" ]; then echo "Found a pre-existing owl-screen session:" echo "$screenlist" echo "You probably want to reattach it instead." echo exit 1 fi # Get AFS tokens for the screen session. # We are now in a new PAG (because of pagsh). # If you want to get tokens for other cells, list them in ~/.xlog aklog || echo "Failed to get new tokens" # Use separate kerberos tickets for screen. Even if we accidentally # (or intentionally) log out, screen and owl will still have tickets. NEWKRB5=/tmp/krb5cc_${USER}_screen # Copy the tickets we obtained on login to the screen tickets. KRB5CCNAME=`echo $KRB5CCNAME | sed 's/FILE://'` if [ "x$KRB5CCNAME" != "x" ]; then cp $KRB5CCNAME $NEWKRB5 else echo "No tickets; not copying to new CC" fi # Now actually use the new tickets. KRB5CCNAME=FILE:$NEWKRB5; export KRB5CCNAME # Repeat for krb4 if appropriate. if [ "x$KRBTKFILE" != "x" ]; then NEWKRB4=/tmp/tkt_${USER}_screen KRBTKFILE=`echo $KRBTKFILE | sed 's/FILE://'` cp $KRBTKFILE $NEWKRB4 KRBTKFILE=$NEWKRB4; export KRBTKFILE fi # Figure out which zephyr client to use. Defaults to barnowl. if [ "x$ZEPHYR_SCREEN_CLIENT" = "x" ]; then barnowl=`which barnowl` if [ ! -x "$barnowl" ]; then attach -n -q barnowl barnowl=`athdir /mit/barnowl`/barnowl fi ZEPHYR_SCREEN_CLIENT="$barnowl" fi # Renew tickets and tokens. contrenew=`which cont-renew-notify` if [ ! -x "$contrenew" ]; then zwrite $ATHENA_USER -d -m "$0: cont-renew doesn't exist on $(hostname)... Not doing renewals" contrenew=/bin/true fi nohup $contrenew < /dev/null > /dev/null 2> /dev/null & # Name the screen pag so we can reattach the right screen later. $screen -S pag