I would like to write a simple script that should work as a daemon. The only thing this daemon has to do, is to check if for a given period neither a key has been hit, nor a mouse moved, nor a touchpad touched, and if it is so, it should switch off the pc.
I realize it is quite a simple program, because it consists of only one condition and one action, but I am clueless how to check this condition of idleness.
w
and see if users are idle.w | awk '{if (NR!=1) {print $1,$5 }}'
– Milind Dumbare Mar 11 '15 at 19:16