How do you deploy cron jobs to production?

后端 未结 9 1024
北海茫月
北海茫月 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:05

    Having your project under version control, including your crontab.txt, is what I prefer. Then, with Fabric, it is as simple as this:

    @task
    def crontab():
        run('crontab deployment/crontab.txt')
    

    This will install the contents of deployment/crontab.txt to the crontab of the user you connect to the server. If you dont have your complete project on the server, you'd want to put the crontab file first.

提交回复
热议问题