How do you deploy cron jobs to production?

后端 未结 9 1026
北海茫月
北海茫月 2021-02-01 18:42

How do people deploy/version control cronjobs to production? I\'m more curious about conventions/standards people use than any particular solution, but I happen to be using git

9条回答
  •  暖寄归人
    2021-02-01 19:17

    Using Fabric, I prefer to keep a pristine version of my crontab locally, that way I know exactly what is on production and can easily edit entries in addition to adding them.

    The fabric script I use looks something like this (some code redacted e.g. taking care of backups):

    def deploy_crontab():
        put('crontab', '/tmp/crontab')
        sudo('crontab < /tmp/crontab')
    

提交回复
热议问题