Skip to content

root user crontabs

Can someone give me an example why and when one should prefer a root user crontab (as in crontab -e) above something defined in or beneath /etc/crontab* – or /etc/periodic or whatever your environment uses?

A normal user crontab, ok, if you really need one which you really can’t or shouldn’t configure to run as root. But for root jobs, I don’t see the point. To let it live beneath /etc seems much more cleaner, to me?

5 Comments

  1. Ghosty wrote:

    Well even though I also did it like this in the past, i learned to do it otherwise:
    etc contains configuration settings for the machine, cron entries you want to create yourself are specific for the root on that particular machine, so they should not live in /etc/crontab, one of the motivations for this is if you start managing multiple servers with centralised tools you add crontabs for that specific user-server environment without having to touch the /etc/crontab file (and also risking to make unwanted changes for cron.daily/weekly/… (which in most of my setups also serve their not unimportant purpose!)

    Friday, March 28, 2008 at 01:14 | Permalink
  2. @gh0sty:

    I’m with you in your reasoning, except I don’t understand what you mean with "cron entries you want to create yourself are specific for the root on that particular machine". If I need to create cron entries for root, then they are specific for that machine, not for me.

    Even if you use centralised tools to manage cron, then you need to stick to that, and define specific crons via that tool. Using user crontabs to circumvent that management tool does not sound like a way to go.

    Besides, such a tool should not interfere with manual configurations, imho.

    One of my motivations is also about having one central place (/etc/crontab) to check for configuration. User crontabs is easily overlooked.

    Anyways, every cron job that needs to be run by root, is for me something machine specific, that should live under /etc.

    Friday, March 28, 2008 at 10:25 | Permalink
  3. Jan wrote:

    At my workplace, we only use the user crontabs.

    Reason for this: everything is stored in a central repository system, from which the settings are "pushed" to the server at certain intervals.

    The system is built in this way that the user crontabs are used, not the /etc/ ones.

    Friday, March 28, 2008 at 18:55 | Permalink
  4. I usually use the "crontab" interface, because that’s what I’ve been using since like forever. Whaddaya mean, "should prefer"? Just use what you think is best!

    Monday, March 31, 2008 at 20:37 | Permalink
  5. When asking about what I "Should prefer" I really mean to check opinions on best practices.

    Monday, March 31, 2008 at 22:54 | Permalink

Analytics Plugin created by Web Hosting