Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

This question already has an answer here:

I have set up a cron job each 12 hours updating a mysql table. The problem is that the cron job keeps restarting randomly every 15 minutes. It doesnt stop the previous one, but instead runs on top of it. Today when I checked, there were 13 jobs doing the same thing.

What is going on? Im on a Linux Server and have setup the Cron Job in cPanel. Any help would be greatly appreciated.

share|improve this question

marked as duplicate by HopelessN00b, kasperd, bangal, HBruijn Feb 24 at 15:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
How can we help you if you don't give us you cron line ? – radius Jul 14 '10 at 15:44
    
0 0,12 * * * /usr/bin/wget lazysundays.com – Petruuz Jul 14 '10 at 15:56
    
line looks good; asked the service provider if something is screwed up on their end? – Chris S Jul 14 '10 at 16:07
  1. Are you sure that the cronjob itself is executing every 15 minutes? Check the cron logfile to see if your cronjob is actually running every 15 minutes. The cron logfile is often at /var/log/cron or it may be logged to /var/log/messages. However, you may need to enable the cron logfile in /etc/syslog.conf (or /etc/rsyslog.conf) first.

  2. Get output from the script. By default on most systems, any output from this cronjob is emailed to the owner of the cronjob. I prefer to write the cron output and error to a logfile. Change your cronjob to look like this:

    0 0,12 * * * /usr/bin/wget lazysundays.com >> /var/log/wget.cron.log 2>&1

Look at the output of the logfile, and you should find the error.

share|improve this answer

can it be that wget times out and re-tries and re-tries and re-tries again?

give wget parameter --tries 1 so it tries only once, add to it --timeout=600 or so - so it does not give up too quickly, and on the top of your script on the server - add something that makes sure php/pearl/whatever else does not timeout too quickly on the server side.

share|improve this answer
    
pQd, if you do not mind, could you be more specific with what I should do. Im not too experienced in this. – Petruuz Jul 14 '10 at 16:26
    
@Petruuz - change your cron syntax into : 0 0,12 * * * /usr/bin/wget --tries 1 --timeout=600 lazysundays.com – pQd Jul 14 '10 at 21:38