This question already has an answer here:

CentOS 5.x

I noticed that someone (presumably another admin) added an entry directly to the bottom of /etc/crontab so it reads like:


# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
00 3 * * 0 root foocommand

Assuming that I indeed want the command to run as root, are there consequences to adding scheduled tasks this way? I'm more accustomed to using crontab -e to add/edit scheduled tasks.

marked as duplicate by Gilles, Ramesh, Anthon, chaos, jasonwryan Nov 14 '14 at 6:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


From running the command in the crontab file there is no difference. At least Vixie cron (as on CentOS) checks every minute if the spool directory's modification time or that of /etc/crontab has changed.

However if you edit via crontab -e, and write the crontab will be checked for glaring errors. E.g if the last line of your crontab is * * * * you will get the message:

crontab: installing new crontab
"/tmp/crontab.HbT2Sa/crontab":27: bad day-of-week
errors in crontab file, can't install
Do you want to retry the same edit? (y/n) 

(at least if that last line is line 27).

Such a checking mechanism is of course not in place if you just add lines to the crontab file (either /etc/crontab or those in /var/spool/cron/).

  • Sorry - I'm still a bit confused. Why is the format different between /var/spool/cron/foo and /etc/crontab. Are two completely different cron tools involved? – Mike B Nov 6 '14 at 17:02
  • @MikeB /etc/crontab is executed by root, and you need to specify a username as who you run the command (6th field). The others are user crontabs, they always run as the user the crontab belongs to, and don't need that field (it's implicit). – Anthon Nov 6 '14 at 17:04

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