I've got a few dozen Linux machines running cron
and I'd like to put the crontabs in some sort of revision control system. For source control I use Mercurial (hg
), so that'd be ideal, but if there's some other system that is better suited to this task I'd consider it.
One aspect which is specific to my situation is that all the crontabs belong to a common user (not a real person, but a placeholder "services" login). I'd like the revision history to include the actual author of each change, rather than the special account where the cron jobs actually run.
crontab -l dumps your crontab to standard output, which you could redirect to a file. You could have a job (in cron, naturally) to redirect this to a file which is then diffed, and pushed to source control as necessary.
http://joey.kitenet.net/code/etckeeper/ ?
From that site:
etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades. It tracks file metadata that revison control systems do not normally support, but that is important for /etc, such as the permissions of
/etc/shadow
. It's quite modular and configurable, while also being simple to use if you understand the basics of working with revision control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With