Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
    
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
add comment

2 Answers

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
add comment
  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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.