Bash inactivity execute script
Hi!
Recently while tuning my bash and whatnot I thought about a nice (but quite unnecessary) little feature to add. Basically, it's a screensaver for bash, so after a certain time of inactivity (eg. 2 minutes) on a bash it will automatically run a program on this bash which then shows some kind of ascii screensaver or what (eg. bb for AA, looks nice) and when I CTRL+C the screensaver I'd have to login again (unlock my session). The screensaver and the locking works quite well so far, the only missing part is the 2 minute timeout. Is there any way to execute a script on a bash after a certain time of inactivity? Thanks in advance, Gachl |
You might want to look into GNU Screen. Screen locking is just the tip of iceberg as far as it's customisation is concerned.
|
redgoblin,
I think you might have misunderstood my problem, I'm not looking for a way to lock a session, I need to run a command after a time of inactivity on a bash. As I already started, the locking part works already. Thanks, Gachl |
Gachl
GNU Screen jumped to mind as it's locking can be set to happen after a certain amount of idle time. However it's an all in one solution and wouldn't necessarily fit in with what you have already. There's a BASH environment variable called TMOUT. But all that can do is log you out after the set idle time. Otherwise, looking around for a possible answer I came across this LQ thread (see third post) which might help. If not then I'm out of ideas but you can at least consider this post a friendly *bump* for your question. Good luck. |
For the moment this solution is working nice, thanks for the link!
If anyone else has other suggestions please do share. |
Adding a note to an old thread in case this is of use to anybody else:
This post at crunchbang http://crunchbang.org/forums/viewtopic.php?id=26447 details a bash script to determine the time in seconds since the last mouse or keyboard action in the system. It doesn't depend on any X session or user being logged in since it's just looking at hardware interrupts. You could modify the scrip to invoke the screensaver & lock rather than suspending the system. So for keyword searches: bash script for user idle / inactive time |
All times are GMT -5. The time now is 05:10 AM. |