cron job not working

0

It is little weird now that cron job is not working as i have set. I have set weekly job to send email but i am receiving multiple emails daily. Below is my code;

# sends email every monday at 4:00 am 
00 04 * * 1  /usr/bin/ruby /home/mbm/www/current/script/runner /home/mbm/www/current/app/models/add_to_delayed_job.rb -e production
  • 00 -> Minutes
  • 04 -> Hours (0-24)
  • 1 -> Days / 0-6 / Sun - Sat

Sending email is fine but the time is not working so far as set.

Thanks in advance

ashisrai_

Posted 2010-10-05T10:42:11.307

Reputation: 101

Which crontab file is this set in? – BloodPhilia – 2010-10-05T18:49:16.173

At what times are the multiple e-mails you are getting being sent? This is probably a good clue into how this is being misinterpreted. – nategoose – 2010-10-05T23:31:53.473

Answers

0

You should really check out the Whenever gem, a nice ruby gem to automate the creation of cronjobs. Screencast about it here (Railscasts).

Then you would do something like this:

every :monday do
  rake "email:send" # My configuration
end

Adds 0 0 * * 1 cd /my/path && RAILS_ENV=production /usr/bin/env rake email:send to my crontab file

But as answer, try as Raghuram said, use 0 4 * * 1 instead.

Terw

Posted 2010-10-05T10:42:11.307

Reputation:

Thanks for the post but I think what I am doing is much less than what it takes with gem. I will look around what is the problem with my code. If not then I have will try with whenever. – ashisrai_ – 2010-10-05T15:18:51.073

0

Looks like your cronjob is set up correctly. Does all email stop if you comment it out? (i.e. could there be another job set up somewhere else?)

Brad Mace

Posted 2010-10-05T10:42:11.307

Reputation: 532