0

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...

p0k3
  • 333
  • 5
  • 23

2 Answers2

0

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.

Jigar
  • 468
  • 1
  • 5
  • 15
0

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"
p0k3
  • 333
  • 5
  • 23