Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron Job Running Even Though Hashed Out

Status
Not open for further replies.

lambic

Technical User
Nov 28, 2002
68
GB
Hi,

We have a backup job in our root crontab which is hashed out, the entry reads:

#00 22 * * 1,2,3,4,5 /usr/local/backup

However, the job still runs each night at 22:00!

Anybody any idea why?

Cheers!

 
Did you use "crontab -e" to edit the crontab or did you edit the file with "vi" or the equivalent?

crontab -e does the right thing. Editing the file by hand does not.

 
As a general rule, it's not good practice to edit the crontab directly using crontab -e in case of slipups and typos which would cause the crontab not to work thereafter.

That said, we all do it! However, for safety it's best to do:

crontab -l > crontemp
edit crontemp to make your change
crontab crontemp - to activate the change.

If there are errors, the crontab won't be changed and you'll be warned that this is the case. Just re-edit crontemp until the change is accepted.

Hope this helps.

 
Hi,

I think it was edited with crontab -e, but I'll re-do it just in case....

Thanks for the replies!

Cheers!
 
Crontab now working OK - thanks everyone.

Cheers!
 
I dont like to use crontab -e to edit my cron files. What I do is vi it manually, then you have to stop and restart the cron to make your changes. vi /var/spool/cron/crontabs/username - make changes
/etc/init.d/cron stop && /etc/init.d/cron start
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top