[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Best practices for cron jobs?

Hi everybody,

What is the best practice when it comes to packages that need to
access a network resource in a daily cronjob? Specifically I'd like to
have a daily cronjob included in the spamassassin package that will
run sa-update. I planned to do this by dropping a con job in
cron.daily. As was pointed out in bug 428319, this results in many
servers hitting the spamassassin update servers at 6:25 am local time
(every server in a timezone that does not have anacron
installed). Ideally this should be spread out throughout the course of
an hour (at least).

Adding a sleep $[ $RANDOM % 60 ] is probably not a good idea as it will
hold up all the other cronjobs that should be run.

I imagine it would be relatively simple to have the postinst generate
a random time during the day for a cron script to run, but this
doesn't work with anacron -- many users would never get updates.

What can I do to satisfy those with and without anacron, and to avoid
hammering the sa-update servers at a specific time?

Duncan Findlay

Attachment: pgpSEF4DSSFmi.pgp
Description: PGP signature

Reply to: