Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

First, your conclusion that there are two cron processes is wrong. There's one cron and onegrep` 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.

share|improve this answer
    
Sorry about the dual output there, lunix mindfart on my part. Turns out it was in both the root crontab and in /etc/crontab I removed it from te root crontab and everything is working fine now. Thank you! –  lampwins Dec 30 '12 at 3:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.