It seems that my cron task doesn't work. Here is the result of "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.
EDIT I had this to my crontab
* * * * * cd && touch .it_works
And... it works...
You told linux what to do as a part of cronjob. But you haven't started cronjob yet. To start cronjob /etc/init.d/crond start.
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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.