tags:

views:

365

answers:

3

*/5 * * * * my command

This entry works but every 5 minutes it get executed twice, why?

In /var/log/cron it shows:
Jun 16 22:20:01 Test CROND[12512]: (root) CMD (my command)
Jun 16 22:20:01 Test CROND[12516]: (root) CMD (my command)

So it's not from two uers.
It is only entered once with crontab -e -u root

The command is a php command.

+5  A: 

Nothing in the description gives reason for it to be executed twice. Look elsewhere.

  • Do two users call it?
  • Is it entered twice?
  • Does it call itself?
  • Does it set in motion conditions for repetition?

If it's a shell script you're executing, have it append whoami and date to a log file. You should be able to dig up the reason.

UPDATE

Type ps -A, make sure crond isn't running twice.

Stefan Mai
pls see updated question
erotsppa
you didn't answer: does it call itself? does it set in motion conditions for repetition?
John Weldon
See updated answer :)
Stefan Mai
A: 

For sure it's not the crontab entry that's causing it to run twice. The fastest way to find out what is going on is to add some debugging to the cron job script. If you do nothing, then by default the cron output will be mailed to root@localhost (unless you have configured this to be different), so assuming you have root access, add some debugging information to the script, such as:

echo "Script starting"
date
whoami

and look at the output. This will get you started as to figuring out how this is getting called twice.

Eddie
+1  A: 

If it's a command for an application you installed, maybe it already added the same entry to /etc/crontab or /etc/cron.d/<something>.

sth