问题原文
原帖链接 · John Jones · CC BY-SA 3.0
In an amazing display of pedantry, a coworker and I have been arguing for literal days over the intended use of the various places for a crontab to live.
At the heart of the matter is a backup script we use to push archives to our customers of their data. Some want that weekly and others want it exactly on certain day of every month - so our current crontab is pretty lengthy. The utility itself is nothing exotic, just a little node script that gets triggered periodically with different sets of customer-ids passed to it.
With all of them being functionally equal, what is the most correct place for a utility to place its crontab?
- In root users personal table (
sudo crontab -e) - In
/etc/crontabor/etc/cron.d
TL:DR; What is the intended use of the various cron locations? And where should the schedule for a utility that needs to run without human interaction go?
已采纳解答
原帖链接 · user9517 · CC BY-SA 3.0
As this is a job that is a functiion of the system I would say use a system crontab. As to which one, I don't think there is really any distinction and I've not seen any direction, even the FSH has little to say. On a CentOS 7 system I have to hand man crontab(5) says
Jobs in /etc/cron.d/
The jobs in cron.d and /etc/crontab are system jobs, which are used usually for more than one user, thus, additionaly the username is needed. MAILTO on the first line is optional.
I would use /etc/cron.d
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
