Search code examples
ruby-on-railscroncapistranowhenever-capistrano

javan-whenever not writing crontab with Capistrano deploy


I’ve been trying to get whenever running on an ec2 instance that was created with ec2 on rails.

When I deploy with Capistrano it indicates that the crontab was written, but when I log into the server and run crontab -l it does not seem to have been changed.

If I go into the release folder and manually run whenever --write-crontab then run crontab -l - it gets updated properly.

Any ideas what could be causing this?

Capistrano is not indicating any errors so not sure how to debug, have tried a billion permutations and combinations and nothing changes.


Solution

  • namespace :deploy do
      desc "write the crontab file"
      task :write_crontab, :roles => [:db_admin] do  
        run "cd #{release_path} && sudo -u root  whenever --write-crontab #{application}"
      end  
    end
    

    Or there is also apparently a -user option in whenever that can help with this.