Re: The XDM trap
*-Raul Miller ( 7 Jul)
| Craig Sanders <cas@taz.net.au> wrote:
| > that's a problem. to implement my suggestion, a failure counter would
| > have to be hacked into xdm itself, or maybe xdm could start a wrapper
| > script which either exec-ed the X server or ran an endless loop if the X
| > server died too often.
|
| Alternatively, you could hack this into X (X on debian systems is
| just a little C program that reads /etc/X11/Xserver and executes it.
|
| It could keep timing information in some file in /var/state/.
|
| So it's doable, the question is: is this the right kind of solution?
|
Why couldn't /etc/X11/xdm/Xreset be used as a place to do the failure
counting? It gets executed after the X server ends(fails).
Please don't laugh or flame, suggetion and comments welcome, but this is
a hack I threw together that could be used in Xreset(I am not a great
scripter). I have not had time to test it so be warned. Lots of ideas
were taken from Craig's post showing the squid setup.
# insert into /etc/X11/xdm/Xreset
XDMLOG=/var/log/xdm-errors
TIMEFILE=/var/state/xdm/time
FAILFILE=/var/state/xdm/fail
# get the current time in seconds since the epoch
CURTIME=`/bin/date +%s`
# get the number of previous failures
if [ -f $FAILFILE ]; then
FAILCOUNT=`/bin/cat $FAILFILE`
else
FAILCOUNT=0
fi
# calculate the time lapse between executions of this script
if [ -f $TIMEFILE ]; then
PREVTIME=`tail -1 $TIMEFILE`
DIFFTIME=`/usr/bin/expr $CURTIME - $PREVTIME`
else
# a default time greater than the cutoff
DIFFTIME=999
fi
# reset was to fast, count it as a failure
if $DIFFTIME -lt 7 ; then
FAILCOUNT=`expr $FAILCOUNT + 1`
echo $FAILCOUNT > $FAILFILE
fi
# to many failures in to short a time frame, kill xdm, and clean up
if $FAILCOUNT -gt 5; then
echo "`date`: Aborting XDM due to repeated frequent failures" >> $XDMLOG
/etc/init.d/xdm stop
/bin/rm $TIMEFILE $FAILFILE
exit 1
else
echo $CURTIME >> $TIMEFILE
fi
--
Brian
--
Mechanical Engineering servis@purdue.edu
Purdue University http://www.ecn.purdue.edu/~servis
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: