Hacker News new | ask | show | jobs
by jlgaddis 2219 days ago
In my experiences, the "standard" way to do this is to simply add a random sleep before running the task.

For example, to run a task at some point between midnight and 3 a.m., you can use this cronjob entry:

  0 0 * * *  sleep $(( $$ \% 10800 )) && /foo/task.sh
Alternatively, systemd has the "RandomizedDelaySec" option.

(Note: 10800 == 60 x 60 x 3, the number of seconds in three hours.)