whenever gem have cronjob on only one machine?

后端 未结 2 2033
旧时难觅i
旧时难觅i 2021-02-04 09:25

We have a large deployment of around a dozen servers. We\'d like to use the Whenever gem but I can\'t figure out a way to say which machine the cron jobs should go on! We only w

2条回答
  •  一生所求
    2021-02-04 10:04

    If you deploy the project with Capistrano and you use the default Whenever recipe, you can create a new Capistrano role

    role :whenever, "192.168.1.1"
    

    and set the role in your deploy.rb file

    set :whenever_roles, "whenever"
    

    In this way, the task will be executed only on the specified server.

提交回复
热议问题