Prev | Current Page 341 | Next

Chris Tyler

"X Power Tools"

10
15.10 Putting It All Together: Scripting a Kiosk 231
# Step 4: Start the browser
$BROWSER $STARTPAGE &
BROWSERPID=$!
# Step 5: Start the network monitoring code
(
sleep 10 # Give the browser a chance to start
STATE="UP"
while sleep $SECONDS
do
$CHECK
RESULT=$?
case "$STATE" in
"UP")
if [ "$RESULT" -ne "0" ]
then
firefox -remote "openurl($WARN)"
STATE="DOWN"
fi
;;
"DOWN")
if [ "$RESULT" -eq 0 ]
then
firefox -remote "openurl($HOMEPAGE)"
STATE="UP"
fi
;;
esac
done
)&
# Step 6: Wait until the application dies
wait $BROWSERPID
# Step 7: Kill everything and start over
killall -KILL $BROWSERPID $XPID
done
The core of the script is a loop, which will restart the kiosk if it stops. The X server is
started without access controls, but only local connections are accepted; in most
cases, that should be sufficient to prevent external clients from connecting.
After the X server is started, the screensaver is started. This is done first to ensure
that the X server always has a connected client, so that it does not reset prematurely
??”or terminate in this case, due to the -terminate option on the X command
line. This enables the script to run xmodmap without the server resetting and clearing
out the xmodmap settings as soon as it??™s done.


Pages:
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
teksty piosenek Dyskusja Nr3 PokerStars kredyt samochodowy Betsson Poker