The first solution, of course, is to write a script running in the background to keep repeating, and then sleep for a period of time each time. Whiletrue; docommandsleepXX // interval seconds done second solution, using crontab. We all know that the minimum granularity of crontab is minutes, but we still...
The first solution, of course, is to write a script running in the background to keep repeating, and then sleep for a period of time each time.
While true; do
Command
Sleep XX // interval seconds
Done
Solution 2: Use crontab.
We all know that the minimum granularity of crontab is minutes, but we can still use a work und to run it every second.
Run the following command every 20 seconds:
Crontab-e
* ***/Bin/date
* *** Sleep 20;/bin/date
* *** Sleep 40;/bin/date
Note: replace/bin/date with your command.
In this way, it is okay to process the scheduled task every several dozen seconds. if you run the task every one second, you have to add 60 records... If it runs every second, use Solution 1.
Author shootyou