Comments on: How to Run or Repeat a Linux Command Every X Seconds Forever https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Thu, 13 Jul 2023 22:17:54 +0000 hourly 1 By: Laura Morris https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/comment-page-1/#comment-1550410 Sun, 18 Jul 2021 15:58:01 +0000 http://www.tecmint.com/?p=18955#comment-1550410 Is there any chance you can help me with this? It is really blowing my mind.

I would like you to create a shell script that runs on an interval of your choosing (10 seconds, 15 seconds, 30 seconds, etc.).

The shell script should:

Log all processes that are running.
If a duplicate program(s) is executed, the shell script will automatically “kill” the process associated with the second instance of that particular program.

The script should:

Redirect the contents of your cron table to a file (Please allow the script to run long enough to capture the data.
You will also have to ensure some program is executed twice so the script will actually kill the process).

This is in centos

]]>
By: v0idkr4ft https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/comment-page-1/#comment-1328976 Wed, 22 Apr 2020 00:12:49 +0000 http://www.tecmint.com/?p=18955#comment-1328976 Thanks, used this plus "$(ls | shuf -n1)" to creating random animated gifs from a folder into a little animated pixel art slideshow in my terminal.

]]>
By: Sachin Tiwari https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/comment-page-1/#comment-1302489 Fri, 06 Dec 2019 07:05:27 +0000 http://www.tecmint.com/?p=18955#comment-1302489 Any idea of how to use the watch and sleep commands together?

Like watch -n 5 "cmd1; sleep 3; cmd2"

e.g. watch -n 5 "date; sleep 3; date"

This doesn’t work as expected. :(

The WAR that I have used is to move command to a script file and use it like watch -n 5 test.sh.

]]>
By: Jim https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/comment-page-1/#comment-1281053 Fri, 01 Nov 2019 21:35:38 +0000 http://www.tecmint.com/?p=18955#comment-1281053 Sounds like you could easily make yourself a fork bomb with a small mistake.

]]>
By: coringa https://www.tecmint.com/run-repeat-linux-command-every-x-seconds/comment-page-1/#comment-937488 Sat, 18 Nov 2017 23:24:40 +0000 http://www.tecmint.com/?p=18955#comment-937488 Oh my god, thanks a lot, i was trying to use cron, but 1 minute is too long, you saved me, a simple command that do the job, thanks a lot man

]]>