#!/bin/ksh ################################################################# # # xtrc # # Shell script for startup of the Xserver connecting SL/AP WGS # # BAT :) # ################################################################# XSERVER=/usr/bin/X11/X XS_ARGS=":0 -once -query" AP_GROUP_DIR=/afs/cern.ch/group/si/slap MAINUSER=hansg if [ -r /etc/src.sh ] then . /etc/src.sh fi if [ -x "$XSERVER" ] then answer=1; lastanswer=$answer while [ answer -ne -2 ] ;do echo "" if [ -f $AP_GROUP_DIR/etc/motd.xtrc ] ;then cat $AP_GROUP_DIR/etc/motd.xtrc echo "" fi echo "XDMCP Servers:" echo "" echo " Host | Nr" echo "-----------+------" echo " slap | 1" echo " | |" echo " +- 01 | 11" echo " +- 02 | 12" echo " |" echo " cernsp | 2" echo " hpplus | 3" echo " hpariel | 4" echo " hpslap02 | 5" echo " hpslap03 | 6" echo "" echo "Local Sessions:" echo "" echo " Session | Nr" echo "-----------+------" echo " HPVue | -1" echo " Console | -2" echo "" echo "Enter Host|Session Nr [$lastanswer]>"; read answer # if [ -z "$answer" ] ;then answer=$lastanswer else lastanswer=$answer fi case "$answer" in -2) echo "Exec /etc/getty console ... "; Host="";; -1) echo "Exec /etc/vuerc ... "; exec /etc/vuerc; Host="";; 1) Host=slap;; 11) Host=slap01; lastanswer=1;; 12) Host=slap02; lastanswer=1;; 2) Host=cernsp;; 3) Host=hpplus;; 4) Host=hpariel;; 5) Host=hpslap02;; 6) Host=hpslap03;; *) echo "Unknown Host|Session Nr [$answer]!" Host=""; answer=999; lastanswer=1;; esac if [ -n "$Host" ] ;then rm -f /usr/adm/Xserver.log echo "Asking $Host for XDMCP Session ... please be patient ... " chown $MAINUSER /dev/console $XSERVER $XS_ARGS $Host /usr/adm/Xserver.log 2>&1 chown root /dev/console fi done # # start Console getty for COUNT in 1 2 3 4 5 do TMP=`/bin/ps -tconsole | /bin/fgrep getty` if [ $? -eq 0 ]; then GETTY=true break fi sleep 1 done if [ -z "$GETTY" ]; then exec /etc/getty console console fi else # # Note: This path occurs if vuelogin can not be found or # is not executable... # # # Wait for the console getty (if any) to start. # for COUNT in 1 2 3 4 5 do TMP=`/bin/ps -tconsole | /bin/fgrep getty` if [ $? -eq 0 ]; then GETTY=true break fi sleep 1 done # # Print a message to the console. # echo "" > /dev/console echo "XServer can not be started. (See /etc/xtrc)" \ > /dev/console # # If a getty is not already running on the console, start one. # if [ -z "$GETTY" ]; then exec /etc/getty console console fi fi ################### eof #####################