Skip to content

Instantly share code, notes, and snippets.

@jbonney jbonney/crontab
Last active Aug 29, 2015

What would you like to do?
Script to check the internet connection of a kiosk and reload the active page in case the connection drops and then comes back online. Sources: - - -…
*/2 * * * * DISPLAY=:0 sh /usr/local/bin/
# The IP for the server you wish to ping ( is a public Google DNS server)
# Only send two pings, sending output to /dev/null
# ping -c2 ${SERVER} > /dev/null
# Using alternative method to pinging to check if the page exists
wget -q --spider
# If the return code from ping / wget ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
# Exit full screen in case of error
xdotool search --onlyvisible "Chromium" windowactivate --sync key F11
# Restart the wireless interface
sudo ifdown --force wlan0
sudo ifup wlan0
# Sleep for 45 seconds to give a chance to the network adapter to get an IP
sleep 45s
# Reload the active page (Google Analytics)
xdotool search --onlyvisible "Chromium" windowactivate --sync key F5
# Restore full screen once connection is established
xdotool search --onlyvisible "Chromium" windowactivate --sync key F11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.