Skip to the content of the web site.

Linux | InactivityScript

#!/bin/bash
# inactivity.sh -- David Collie
# checks for screen blanking, when this occurs wait one minute before killing
# firefox, thus restarting X
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11
DISPLAY="localhost:0.0"

xscreensaver-command -watch |
{
  while read line; do
    # if the screen has been blank sleep for 60 seconds
    # then check again, if it's still blank reset the kiosk
    if [ -n "$(echo $line | egrep '^BLANK.*')" ] ; then
        sleep 60
      if [ -z "$(xscreensaver-command -time | grep 'non-blanked')" ]; then
        killall firefox-bin
      fi
    fi
  done
}

-- DavidCollie - 04 Oct 2004