Cron jobs that repeat often, e.g. every 5 or 10 minutes, can be easily set up with something like
*/5 * * * * $HOME/bin/every5minutes.sh
Though, all of these cron jobs start at the same time intervals. In case of more expensive jobs or a hell of lot of whatever jobs one might want to try to distribute them. One way of doing this is of course
4,9,14,19,24,29,34,39,44,49,54,59 * * * * $HOME/bin/every5minutes.sh
Another approach is to sleep some random time before doing the actual job, and some scripts have this built in. On systems using Bash as the main (default/cron) shell one can use bash's built-in variable RANDOM like in
*/5 * * * * sleep $((RANDOM * 60 / 32767)) ; $HOME/bin/every5minutes.sh
If you are like me, and you have to put each and everything into a shell script, well, then you will probably call it something like blur and use it as
*/5 * * * * blur 60 ; $HOME/bin/every5minutes.sh
Hey, blur.sh comes even with a GPL license
Note that the cron examples above are for users' crontabs, not root's.
disclaimer & imprint :: copyright :: backlinks :: page history :: index :: recent changes (all) :: go to top ::
Discussion