javan-whenever not writing crontab with Capistrano deploy
-
06-07-2019 - |
Question
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 2
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.
OTHER TIPS
you should be able to just require the whenever capistrano command in your cap deploy file like so:
require 'whenever/capistrano'
if you're using bundler, you'll need to add this as well:
set :whenever_command, 'bundle exec whenever'
This is not related to OP, but according to this issue, Capistrano 2.11.1 needs Whenever 0.7.3 in order to fix the issue.