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. |
Two options come to mind:
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. |
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. |
The most simplest way to execute a command after a certain time period is with sleep
Code:
sleep 5m ; cmatrix -b |
All times are GMT -5. The time now is 10:10 AM. |