I have a common puppet recipe for a set of our servers. One of the puppet-managed files is
/etc/crontab that contains the original
The problem of the common
/etc/crontab file here is that all cronjobs are run at the exactly same time in all of our servers. For example, daily backups consumed all our backup server resources as all servers are feeding it at same time.
What is the preferred way to randomize the exact minute of the daily/weekly/monthly runs between servers, while still keeping the puppet recipe common between all servers?
I have been thinking a few different options:
$RANDOMbefore the actual job. In this way, the
crontabwould be similar in every host but the exact time of running the daily/weekly jobs would vary. There would be variation even inside the same server (for example daily run interval could vary between 23-25 hours).
- Calculating an integer value from the hostname and running all jobs with
at+ "the hostname-based integer" minutes. A bit hacky, but might work...
- Some other method, but what?