Why is this cron entry executed twice?
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.
The wget in crontab has often a limit of 15 minutes. In our case this was just the case, and after those 15 minutes the job ends up with a timeout and then re-runs again right away. So, the solution to this was to set up the cronjob in crontab somewhat like this :
1 2 * * * root wget --read-timeout=3600 -O - 'http://cron-job-url' >/dev/null 2>&1
...instead of
1 2 * * * root wget -O - 'http://cron-job-url' >/dev/null 2>&1
So, wget is the thing. Meaning 3600 = 1 hour then. Or more if you need!
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>
.
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 | grep crond
, make sure crond isn't running twice.