Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i can get terminal idle time by w command as follows

$ w
 14:37:58 up 2 days, 20:16,  2 users,  load average: 0.12, 0.16, 0.14
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
charan   tty7                      Fri18    2days  3:53   0.33s gnome-session --session=ubuntu
charan   pts/0    :0               14:33    6.00s  0.19s  0.00s w

and tty gives me current tty as bellow

$ tty

And i want to run a shell script in same tty when idle time is more than some x value How can i do that ?

share|improve this question

Probably Getting idle time in linux will be useful for you. There is C source that you can use.

share|improve this answer
I havnt used Ruby, So i am not able to run it in my system :( – Charan Pai Jul 9 '13 at 11:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.