
Sometime there are many jobs to be executed at the same time (e.g. 12 AM daily), and it posed heavy load on the host. If the jobs are not time-sensitive, random-time delay can be introduced to mitigate such issue.
0 0 * * * sleep $((RANDOM % 3600)); /the/execution/script.sh
RANDOM is a bash built-in variable that generates a random integer. RANDOM % 3600 generates a random integer between 0 and 3600 (exclusive). 3600 seconds is equivalent to 1 hour, you can adjust this number to suit your need. The sleep command creates delay in the specified number of seconds.
About the author
- I work with Linux in the day, ballroom dancing at night. I use Arch, btw.
Comments
Join the discussionNo comments yet. Be the first to comment.




