手动重启的missed_job有效,但不能通过crontab

时间:2018-02-19 12:22:06

标签: ruby-on-rails cron delayed-job

如果我手动运行我的脚本,即sh /home/deploy/scripts/cleanup.sh,一切正常,但是当通过crontab执行相同的脚本时,delayed_job部分不起作用(其他一切都有效!)

# Restart all processes
cd ~/apps/kosher/current
~/.rvm/bin/rvm default do bundle exec pumactl -S /home/deploy/apps/kosher/shared/tmp/pids/puma.state -F /home/deploy/apps/kosher/shared/puma.rb stop
~/.rvm/bin/rvm default do bundle exec puma -C /home/deploy/apps/kosher/shared/puma.rb --daemon
if RAILS_ENV=production bin/delayed_job restart
 then 
  echo "kosher delayed_job restarted" >> /home/deploy/scripts/cleanup.log
 else
  echo "kosher delayed_job restart failed" >> /home/deploy/scripts/cleanup.log
fi

我尝试使用~/.rvm/bin/rvm default do bundle exec bin/delayed_job -n 1 restart代替RAILS_ENV=production bin/delayed_job restart,但后来我收到一条错误,说明我错过了listen-gem:

bundler: failed to load command: bin/delayed_job (bin/delayed_job)
LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile

但是,我的Gemfile确实包含了gem。

为什么我不能通过crontab重新启动delayed_job?

0 个答案:

没有答案