Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Oct 5 '10 at 12:31

This question came from our site for professional and enthusiast programmers.

Which crontab file is this set in? – BloodPhilia Oct 5 '10 at 18:49
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 Oct 5 '10 at 23:31

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

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.

share|improve this answer
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. – a5his Oct 5 '10 at 15:18

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?)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .