#!/bin/sh # dbus-monitor --session interface=org.gnome.ScreenSaver | # dbus-monitor --session >>dbus-monitor--session1 & # Get the log into the NFS cache sum ~/ScreenSaver.log > /dev/null prev_time=$SECONDS print_time() { let time=SECONDS-prev_time let hours=time/3600 min=time/60%60 sec=time%60 printf ": %d:%02d:%02d\n" $hours $min $sec prev_time=$SECONDS } dbus-monitor --session 'interface=org.gnome.ScreenSaver,member=ActiveChanged' | while IFS='' read j do TS=`date` if expr "$j" : ' ' >/dev/null then # Continuation line echo -n " :$j" DATA="$DATA$j" else # Initial line #echo print_time echo -n "$TS $j" DATA="$j" fi if expr "$DATA" : '.*ScreenSaver.*boolean true' >/dev/null then # Screen locked ssh-add -D >/dev/null fuser -k -TERM /home/dave/.fpm/fpm* >/dev/null 2>&1 fi done >> ~/ScreenSaver.log