<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 3, 2018 at 10:44 AM, Alex Beamish via talk <span dir="ltr"><<a href="mailto:talk@gtalug.org" target="_blank">talk@gtalug.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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?<div><br></div><div>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.</div></div></blockquote><div><br></div><div><br></div><div>I do this using git and SaltStack. Here is my Salt state for managing the root crontab.</div><div><br></div><div> cron:</div><div>    service.running:</div><div>        - name: cron</div><div>        - enable: True</div><div><br></div><div>root-crontab:</div><div>    file.managed:</div><div>        - name: /root/root-crontab</div><div>        - source: salt://cronjobs/root-crontab</div><div>        - template: jinja</div><div>    cmd.run:</div><div>        - name: cd /root; /usr/bin/crontab -r; /usr/bin/crontab root-crontab</div><div><br></div><div>The file called root-crontab is under revision control. One of the things that is in root-crontab is first, updating the Salt states and second, invoking them. That could include updating the root-crontab. There are other ways of doing this in SaltStack.</div></div></div><div class="gmail_extra"><br clear="all" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div class="gmail_signature"><div dir="ltr">Regards,<div><br></div><div>Clifford Ilkay</div><div><br></div><div>+1 647-778-8696</div></div></div></div></div></div><img src="https://my-email-signature.link/signature.gif?u=206693&e=22875342&v=7fe7b65015e69a7fa657b06d004d7f2a57baceb211f3e57f9c5eb4965abb5039" style="width:0;max-height:0;overflow:hidden">