sh :: monitor server availability, warn user if service unavailable
#
# === Configuration variables
# Seconds between service availability tests
SECONDS=15
# Command to test the server availability
CHECK="ping yellow"
# File containing a full-screen warning image
WARN="file:/usr/local/kiosk/outage_warning.tiff"
# === End of configuration variables
STATE="UP"
while sleep $SECONDS
do
$CHECK
RESULT=$?
case "$STATE" in
"UP")
if [ "$RESULT" -ne "0" ]
then
xloadimage -fullscreen $WARN
STATE="DOWN"
fi
;;
"DOWN")
if [ "$RESULT" -eq 0 ]
then
killall xloadimage
# Add any application-reset commands here
STATE="UP"
fi
;;
esac
done
15.8
228 Chapter 15: Building a Kiosk
If xloadimage is not included with your distribution/system, you can
obtain it from ftp://ftp.x.org/R5contrib/ or use a similar application
such as ImageMagick??™s display. Note that both xloadimage and display
can be exited by pressing Q, so they may not be appropriate for desktops
that are equipped with a full keyboard (but will work fine on
kiosks that have only a keypad, soft keys, or a pointer device).
15.8 Using xscreensaver to Reset a Kiosk
It??™s often desirable to reset a kiosk after a period of inactivity.
Pages:
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348