LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How run script after certain idle time? (http://www.linuxquestions.org/questions/linux-software-2/how-run-script-after-certain-idle-time-341637/)

nio 07-09-2005 12:40 PM

How run script after certain idle time?
 
Hi-ya,

I want a script to be run every time I'm idle for 10 minutes.
I want a script to be run when I become active again.
I want it to work whether I'm in the console or in X (although if I had to choose, the idle time would have to be based on X activity).

I tried to make xscreensaver run a script, but without success, first it gave me the error "test: missing argument", and lateron, I got "test: -window-id: binary operator expected", but I'd like my screen not to go blank at all, so the xscreensaver wouldn't work in this case.

The command "w" gives the idle time of shell logins, but doesn't count X idle time.

The idea originally was to set server-bandwidth to max if idle, and back to minimal when I become active again, but I'm going to try and solve that with traffic shaping techniques.

I'd like to use the idle time for cleanup scripts, backup scripts and other useful tasks.

Anyone know how to achieve this?

homey 07-09-2005 02:02 PM

Check out this article about idleize
http://www.pattosoft.com.au/jason/idleize/

Maybe more out there from googling linux cpu idle time.

zen0n 07-09-2005 02:05 PM

What about monitoring the load on the machine? With some grep/awk magic you could run a script that would do whatever you want between certain load values.

Probably wouldn't be the most responsive as I don't think load values are continiuously updated, but its a idea.

Ryan


All times are GMT -5. The time now is 09:25 AM.