15.7 Network Status Monitoring
Impaired or broken kiosk operation can be very frustrating to users, so automatic
monitoring (and notification) of network status may help prevent users from taking
out their frustration on your hardware.
If you??™re using a browser as your kiosk application, you can use a command such as
wget to periodically poll the server and determine whether it is available. For example,
if the main index page for the kiosk is http://yellow/, you could check whether
the remote server is prepared to serve that page with this command:
blue$ wget http://yellow/ --spider -t 1
The exit status will be 0 if the page is available, or 1 if it is not. The --spider argument
instructs wget to check the page availability (using the HTTP HEAD command)
rather than retrieve the page (using HTTP GET), therefore reducing the amount of
data transferred over the network.
If you??™re using another network-based service, you can use any other appropriate
tool (such as ping for general server connectivity, showmount -e for NFS servers, or a
netcat or a Perl script for a custom service) to test whether the service the kiosk
needs is available.
15.7
226 Chapter 15: Building a Kiosk
Using the wget command, we can create a script that will place a message on the
kiosk display when the remote server becomes unavailable and removes it when the
remote server comes back online:
#!/bin/bash
#
# monitor.
Pages:
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346