On Fri, May 4, 2018 at 8:11 AM, Jamon Camisso via talk <talk@gtalug.org> wrote:On 2018-05-03 10:44 AM, Alex Beamish via talk wrote:
> I'm developing scripts that get run by crontab, so I'm in there making
> updates fairly regularly. I would love to be able to document the changes,
> so I'm wondering if there a usual and customary technique to version
> crontabs?
What are you changing in crontabs so much that you need versioning?I'm developing EDI scripts, and as development progresses, some of the older scripts are being replaced by newer scripts. On occasion, there are times when I need to disable a crontab job while I solve an issue.Having version control would be a great back-stop, and would also be useful from a historical point of view. (Why did I disable that job last Thursday? Where did the such and such script go?)Shouldn't all the logic be in your scripts? Maybe I'm missing something,
but it seems like needless complication to me.What to do and how to do it is in the scripts. How often to do it is in the crontab.
> Ideally there would be some sort of hook around 'crontab -e', but failing
> that, I'd have the output of 'crontab -l' (run regularly by cron?) go to a
> versioned file. Plan B sounds a bit hokey to me.
If you do need to version things, you can just chuck a git repo under
/var/spool/cron/crontabs and ignore any files there you don't want tracked.Under my system, that directory is owned by root, and I prefer not to version anything as root; the code I'm developing is application code, not system code.