views:

160

answers:

1

What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates, ...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab?

I know that the actual cron files are stored in /var/spool/ but I've heard that it is severely unwise to edit these directly. How do other people do it?

+2  A: 

You can (on most Linux distributions) put files in /etc/cron.d instead of an individual user's crontab. They can be run by whatever user you want (you need to be root, obviously).

If you build your web app into a RPM (debian pkg, etc), then it can drop the files into /etc/cron.d and have the jobs run.

Just load the same RPM on to your system test machine to check that it all works first - job done.

MarkR