You are not logged in.

#1 2010-10-14 14:59:34

Isola
Member
Registered: 2010-02-02
Posts: 99

[SOLVED] Execute command after being idle x minutes

Hi archers!

Is there any command or file which can tell for how long I've been idle?

I know that the `w' command shows idle time for non X, but I want something which will work for both X and console.

One of the ideas I had is to `/etc/rc.d/sshd stop' when I've been away for x minutes, and `/etc/rc.d/ssh start' when I get back.

Thank you!

Last edited by Isola (2010-10-14 19:03:13)

Offline

#2 2010-10-14 16:06:02

Stebalien
Member
Registered: 2010-04-27
Posts: 1,239
Website

Re: [SOLVED] Execute command after being idle x minutes

If you want to start/stop sshd when needed/uneeded, use xinetd to dynamically start it per connection.
For running a task on idle, look xautolock.
For something a little more flexable, you could write a python script: http://thp.io/2007/09/x11-idle-time-and … ow-in.html
You could also write a shell script using xprintidle from AUR.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C

Offline

#3 2010-10-14 19:27:22

Isola
Member
Registered: 2010-02-02
Posts: 99

Re: [SOLVED] Execute command after being idle x minutes

xprintidle is just what I need! I'll write a little shell script to be executed automatically by cron then. Thank you smile

Oh! I didn't think about xinetd, I use it for the bitlbee daemon actually. Works perfectly for that. But the other commands I want to be executed won't work with xinet.

Perhaps I should volunteer to one of those grid computing projects when I become idle. Suggestions on which to choose are welcome! smile

Offline

#4 2010-10-14 23:45:09

hurleyef
Member
Registered: 2010-06-22
Posts: 72

Re: [SOLVED] Execute command after being idle x minutes

folding@home IMO

Offline

Board footer

Powered by FluxBB