Schedule deployment fails when user doesn't yet have a crontab
I added these lines to deploy.rb as instructed. set :whenever_command, "bundle exec whenever" require "bundler/capistrano" require "whenever/capistrano"
I got the following error when I tried to run cap deploy. Any ideas? My schedule.rb is commented out so it is not that. My ruby is 2.1.3 and rails is 4.1.8. This happens when it executes `whenever:update_crontab'.
** [out :: mydomain] /path/to/app/shared/bundle/ruby/2.1.0/gems/whenever-0.9.4/lib/whenever/command_line.rb:77:in `write_crontab':
** [out :: mydomain] undefined method `zero?' for nil:NilClass (NoMethodError)
** [out :: mydomain] from /path/to/app/shared/bundle/ruby/2.1.0/gems/whenever-0.9.4/lib/whenever/command_line.rb:35:in `run
Can you paste your schedule.rb file please? You can exclude the contents of the every blocks if you'd like.
Seems I needed an existing cron tab on the server for this to work. After I added one using "crontab -e", I was able to deploy successfully. My schedule.rb was commented out before.
Eric Coulthard
On Sun, Dec 21, 2014 at 1:25 PM, Javan Makhmali [email protected] wrote:
Can you paste your schedule.rb file please? You can exclude the contents of the every blocks if you'd like.
— Reply to this email directly or view it on GitHub https://github.com/javan/whenever/issues/517#issuecomment-67783311.
I just had the same issue - perhaps something in the documentation would help with this. I had to do crontab -e to initiate the crontab for the user before the deployment would succeed.
Do you have an easy way to reproduce this? On a fresh Ubuntu 14.04 server I cannot.
Hi. I'm getting same error message on a VPS, having an already created crontab for the user.
/usr/local/rubies/ruby-2.1.6/lib/ruby/gems/2.1.0/gems/whenever-0.9.7/lib/whenever/command_line.rb:78:in `write_crontab': undefined method `zero?' for nil:NilClass (NoMethodError)
from /usr/local/rubies/ruby-2.1.6/lib/ruby/gems/2.1.0/gems/whenever-0.9.7/lib/whenever/command_line.rb:37:in `run'
from /usr/local/rubies/ruby-2.1.6/lib/ruby/gems/2.1.0/gems/whenever-0.9.7/lib/whenever/command_line.rb:6:in `execute'
from /usr/local/rubies/ruby-2.1.6/lib/ruby/gems/2.1.0/gems/whenever-0.9.4/bin/whenever:41:in `<main>'
Nevetherless the crontab is written/updated ok. As I see the problem is when checking $?.exitstatus that is seems to be null, that's why is written ok despite getting an error.
I don't have much control because of a jail environment but in case it helps here is the linux version i got from uname -r Linux version 2.6.32-573.22.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) )