1834149 Members
2456 Online
110064 Solutions
New Discussion

cron hunt - round 3

 
SOLVED
Go to solution
Bill Brutzman
Frequent Advisor

cron hunt - round 3

When I do a crontab -l it shows me a cron script; but thus far, I have not been able to find out this script is located. I did a
find . -name 'cron' and picked through the results.

Comments would be appreciated.

Regards,

Bill

D. Allen nailed round 2. There was a cron script that referenced a directory that had been removed. There were chmod commands in there that whacked other directories. Thanks to all who responded.

4 REPLIES 4
Andreas D. Skjervold
Honored Contributor
Solution

Re: cron hunt - round 3

Hi

/var/spool/cron/crontabs

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
BFA6
Respected Contributor

Re: cron hunt - round 3

Hi,

Have you looked in /var/spool/cron/crontabs - file name is same as the user you are logged in as.

Hilary
Darrell Allen
Honored Contributor

Re: cron hunt - round 3

Hi Bill,

Crontabs are stored in /var/spool/cron/crontabs. You should not edit these files directly.

You have 2 options. "crontab -e" makes a temp copy of your crontab, puts you into edit mode on the temp copy (generally with vi), then replaces the original in /var/spool/cron/crontabs.

The preferred method of editing a crontab is to use "crontab -l >crontab.cpy" to make a copy of the crontab. Edit that file then use "crontab crontab.cpy" to make it active.

man crontab for more info.

Before doing any edits on your crontab I'd suggest you back it up. For root, a number of people do:
cd /var/spool/cron
cp -p crontabs/root root.crontab

Personally, as the admin of the box, I like to backup all the crontabs:
cd /var/spool/cron
mkdir crontabs.bak
cp -p crontabs/* crontabs.bak

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Robin Wakefield
Honored Contributor

Re: cron hunt - round 3

Hi,

One other suggestion is to use cron to back itself up:

0 0 * * * crontab -l > /usr/local/etc/crontab

then you haven't got to worry about it.

Rgds, Robin.