Search code examples
linuxcronredhatrhel

Crontab is running command 3 times each run


I have the following crontab set up on a RHEL server ...

MAILTO=me@mydomain.com
*/2 * * * * wget --spider -q http://mydomain.com/cronjobs/importxml.php

As you can see this should run every 2 minutes, which it does, but it runs the command three times and I can't figure out why.

If I run

tail /var/log/cron

I get the following

Dec 12 13:56:01 msvsc02-g283nc crond[1431]: (root) RELOAD (cron/root)
Dec 12 13:56:01 msvsc02-g283nc crond[3224]: (root) CMD (wget --spider -q http://mydomain.com/cronjobs/importxml.php)
Dec 12 13:56:01 msvsc02-g283nc crond[2504]: (root) RELOAD (cron/root)
Dec 12 13:56:01 msvsc02-g283nc crond[3226]: (root) CMD (wget --spider -q http://mydomain.com/cronjobs/importxml.php)
Dec 12 13:56:01 msvsc02-g283nc crond[2472]: (root) RELOAD (cron/root)
Dec 12 13:56:01 msvsc02-g283nc crond[3228]: (root) CMD (wget --spider -q http://mydomain.com/cronjobs/importxml.php)

Can anyone shed any light on this?


Solution

  • You may have more than one cron process running in that server. This normally wont happen. But anyway confirm it with

     ps aux | grep cron
    

    You can stop it by,

    /etc/init.d/cron stop
    

    or

    service cron stop
    

    or use 'kill PID' ( not recommended ).

    And to start use start - instead of stop in either of above two commands.