LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-24-2012, 04:23 AM   #1
williantalvane
LQ Newbie
 
Registered: Jul 2012
Posts: 2

Rep: Reputation: Disabled
Smile automatically run command in terminal after x minutes of idle time.


Hi, I'd like to know if there is any way to automatically run a specific command in the terminal after the terminal has been idle for x minutes. I use terminator, so I have several terminal windows open at the same time. What I want to do is to make my terminal run a command when the idle time reaches x minutes. The command I want to run is:
> cmatrix -b

It's just a fun command that I want to use as a terminal screen saver.
I think I want something like this in my .bashrc file:

> if (terminal.idle.time = 5 min) {
> cmatrix -b
> } else {
> do nothing}

Is it possible?

Thanks a lot.

Last edited by williantalvane; 07-24-2012 at 04:25 AM.
 
Old 07-25-2012, 06:31 PM   #2
whizzit
Member
 
Registered: Aug 2004
Location: UK
Distribution: Gentoo, OpenBSD, Debian, FreeBSD, RHEL, CentOS
Posts: 65

Rep: Reputation: 24
Two options come to mind:
  1. xidle
  2. xautolock

I presume you're using Ubuntu, from your post icon.

The first I've used in the past (maybe on BSD) but can't find this in standard repos for Linux (well Debian & Ubuntu).
By the look of it the second could be fashioned to use with --time and specifying a script to --notifier or --locker.
 
Old 02-20-2013, 12:42 PM   #3
williantalvane
LQ Newbie
 
Registered: Jul 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I still don't know how to do that. Could you explain me how xautolock would do that? What I want is very simple. I want to script that says:
If terminal idle time reaches 5 min, the terminal will execute the following command: cmatrix -b
There must be some way to do this simple task.
 
Old 02-21-2013, 11:21 PM   #4
codergeek
Member
 
Registered: Dec 2012
Posts: 52

Rep: Reputation: 7
The most simplest way to execute a command after a certain time period is with sleep

Code:
sleep 5m ; cmatrix -b
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do i run a command every day at a certain time automatically? Squerl101 Linux - Server 6 11-04-2011 05:39 AM
How can Fedora run automatically a Terminal command at the startup? cesar7160 Fedora 4 05-19-2009 11:54 AM
Automatically Disconnecting Users After Five Minutes Idle Time kaplan71 Linux - Server 3 05-21-2008 10:13 PM
System will automatically close my x server after a certain idle time. ICO Slackware 1 02-16-2004 11:26 AM
start terminal & run command automatically peeples Linux - General 2 09-08-2003 02:57 PM


All times are GMT -5. The time now is 03:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration