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 rogue cron job that runs every 10 minutes on a Centos system.

How do I find all the jobs that are performed?

share|improve this question
    
How do you know it's a cron job? –  coredump Aug 17 '10 at 14:56
add comment

3 Answers

up vote 1 down vote accepted

See this question on StackOverflow (How do I list all cron jobs for all users?). The short version is that you could run the following (@Kyle Burton's answer on that question):

for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done

There is also a more indepth script that you could copy and run on that post.

share|improve this answer
    
thats pretty cool . –  jini Aug 17 '10 at 17:11
1  
jini: Be aware that this is not necessarily going to find your rogue job. It will only work if your rogue job is in a crontab of a current user and not in /etc/crontab or /etc/cron.daily/* etc or a crontab of a deleted user. –  Richard Holloway Aug 17 '10 at 17:20
add comment

Or if you're root, just check the directory /var/spool/cron/tabs. In there should be a complete list of all user crons. There are also crons that run out of the /etc/cron* directories. Just run:

# ls -l /etc/cron*
# ls -l /var/spool/cron/tabs/

To see them all.

share|improve this answer
add comment

You could do something like this:

for crontab in `ls /etc/cron.*/* /var/spool/cron/* /etc/crontab`
do
    echo $crontab
    cat $crontab
done

And remember to check the log file /var/log/cron or similar which will list everything that has been run by cron.

share|improve this answer
add comment

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.