Execute shell script or command on idle time
I'm searching for the possibility to execute a shell script or command based on idle time in the bash shell.
As an example, if I'm in a SSH session to a server of mine and after X minutes of inactivity in the terminal, I want a command to start a desired program like cmatrix
, and when I come back and press a key I will get back where I left.
Solution 1:
Apparently GNU screen has screensaver capabilities similar to what you're asking, if you put this in your .screenrc
:
blankerprg cmatrix -ab -u2
idle 60 blanker