Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab revision control?

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.

like image 496
John Zwinck Avatar asked Nov 25 '08 16:11

John Zwinck


2 Answers

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.

like image 172
bradheintz Avatar answered Sep 22 '22 02:09

bradheintz


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.

like image 36
Daniel Bungert Avatar answered Sep 19 '22 02:09

Daniel Bungert