[英]Cron generated by Whenever doesn't work
It seems that my cron task doesn't work. 我的Cron任务似乎无法正常工作。 Here is the result of "contrab -l" 这是“ contrab -l”的结果
# Begin Whenever generated tasks for: /home/mtaville/mtaville_staging/releases/20140827132856/config/schedule.rb
* * * * * /bin/bash -l -c 'cd /home/mtaville/mtaville_staging/releases/20140827132856 && RAILS_ENV=staging bundle exec rake events:archive_outdated_event --silent'
# End Whenever generated tasks for: /home/mtaville/mtaville_staging/releases/20140827132856/config/schedule.rb
Here is some lines of logfile : 这是日志文件的一些行:
Aug 28 13:42:01 67872hd63015 CRON[489]: (mtaville) CMD (/bin/bash -l -c 'cd /home/mtaville/mtaville_staging/releases/20140827132856 && RAILS_ENV=staging bundle exec rake events:archive_outdated_event --silent')
Aug 28 13:42:18 67872hd63015 crontab[495]: (mtaville) LIST (mtaville)
Aug 28 13:43:01 67872hd63015 CRON[498]: (mtaville) CMD (/bin/bash -l -c 'cd /home/mtaville/mtaville_staging/releases/20140827132856 && RAILS_ENV=staging bundle exec rake events:archive_outdated_event --silent')
When I copy/past the code of log : 当我复制/粘贴日志代码时:
/bin/bash -l -c 'cd /home/mtaville/mtaville_staging/releases/20140827132856 && RAILS_ENV=staging bundle exec rake events:archive_outdated_event --silent'
it works ! 有用 !
What's the problem ? 有什么问题 ?
The cron file is generated by Whenever a Gem of Ruby on Rails. cron文件由“ Ruby on Rails宝石”生成。
EDIT I had this to my crontab 编辑我已经到我的crontab
* * * * * cd && touch .it_works
And... it works... 而且...有效...
You told linux what to do as a part of cronjob. 您告诉linux作为cronjob的一部分该做什么。 But you haven't started cronjob yet. 但是您还没有开始cronjob。 To start cronjob /etc/init.d/crond start. 要启动cronjob /etc/init.d/crond,请启动。
Just for those who have the problem : 仅针对那些有问题的人:
Create a job type : 创建工作类型:
job_type :rbenv_rake, %Q{export PATH="$HOME/.rbenv/bin:$PATH" ; eval "$(rbenv init -)" ; cd :path && :environment_variable=:environment bundle exec rake :task --silent :output }
Use it : 用它 :
rbenv_rake "cars:import"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.