Ubuntu – Fixing Cron Jobs Running Twice on Ubuntu Server 12.04

cronlinuxprocessUbuntu

I have a couple of simple cron jobs running under root. However, they seem to be running twice, and I can't figure out why. No other users have any cron jobs running and the the only cronfile is for root. The jobs complete just fine, but twice.

Here is the root crontab file:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * cd / && run-parts --report /etc/cron.hourly
25 6 * * * test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
0,30 * * * * sh /scripts/amsbackup.sh 
0,15,30,45 * * * * sh /scripts/dbbackup.sh
#

I did check to see if cron was running twice by exicuting, ps aux |grep cron here is the output indicating there are in deed two processes:

root      9822  0.0  0.0   2620   892 ?        Ss   Dec24   0:01 cron
root     19146  0.0  0.0   3904   788 pts/1    S+   21:27   0:00 grep --color=auto cron

So what is going on, and how can I prevent it?

Thank you for any help.

Best Answer

First, your conclusion that there are two cron processes is wrong. There's one cron and one grep in your output.

Next, you say that the quoted file is in your root crontab. What you quoted says that it's in /etc/crontab. So, is that the contents of /etc/crontab or crontab -l -u root? Those are two distinct things.

If it's both, well, then you're telling it to run those things in one place and then in another place, so twice. You probably want to remove it all from root's crontab.