Why is cron running twice?

I wanted to execute my PHP mailing-script automatically with cron. I always get the mail twice though. The script runs fine when started manually.

I put this in the crontab for testing:

54 13 * * * echo "This is a test" >> /opt/test.txt

, which printed the line twice into the file.

This is what /var/log/messages says:

Mar  3 13:54:01 server1 crontab[22076]: (root) BEGIN EDIT (root)
Mar  3 13:54:01 server1 /usr/sbin/cron[2268]: (root) RELOAD (/var/spool/cron/tabs/root)
Mar  3 13:54:01 server1 cron[19402]: (root) RELOAD (/var/spool/cron/tabs/root)
Mar  3 13:54:01 server1 /USR/SBIN/CRON[22085]: (root) CMD (echo "This is a test" >> /opt/test.txt)
Mar  3 13:54:01 server1 CRON[22086]: (root) CMD (echo "This is a test" >> /opt/test.txt)

Also, ps aux |grep cron gets me this:

root      2268  0.0  0.0   3168   712 ?        Ss   Jan24   0:55 /usr/sbin/cron
root     19402  0.0  0.0   3452   720 ?        Ss   Feb12   0:27 cron
root     22538  0.0  0.0   2504   504 pts/0    S+   14:06   0:00 grep cron

The server's OS is openSUSE 11.4

Cheers!


Solution 1:

It looks like there are two instances of cron running :

  • The fist one (pid 2268), launched at system boot (Jan24)
  • The second one (pid 19402), probably launched manually later (Feb12)

You can probably kill the second instance.