On 2010-08-17 19:57, Brian K. White wrote:
crontab -e, as root, edits the root users own crontab (/var/spool/cron/tabs/root) , which on legacy unix systems was the system crontab. You can use that if you want, it will work as expected.
On linux, or more correctly, when using vixie-cron on whatever platform, /etc/crontab is the "system" crontab and it has a different syntax than the individual users crontabs. For one thing it has an extra field between the time specs and the command, which is the user the job should run as. They are not simply run as root the way jobs in root's crontab are. Also there is a small prefix (-) you can add to the beginning of a line to tell cron not to write a line to syslog every time it runs that job.
You can edit /etc/crontab directly with any editor of your choice at any time and the effects take place immediately when you save the file. No need to restart cron, no need to notify cron or reload the file with the crontab command.
You can also create scripts in /etc/cron.d/* and not write any crontab entries in any crontab anywhere. /etc/crontab already includes entries to periodically run any scripts found in those directories. If you need to specify the particular time of day, instead of accepting whenever "nightly" happens to run, then you need to write a crontab entry.
I'm saving this, it is a nice summary, not so easy to locate that info in the man pages. :-) One note, though: you don't need to edit the file if you want to adjust the time to run since oS 11.2, we have an addition to the scripts: /etc/sysconfig/cron: ## Type: string ## Default: "" # # At which time cron.daily should start. Default is 15 minutes after booting # the system. Example setting would be "14:00". # Due to the fact that cron script runs only every 15 minutes, # it will only run on xx:00, xx:15, xx:30, xx:45, not at the accurate time # you set. DAILY_TIME="" ## Type: integer ## Default: 5 # # Maximum days not running when using a fixed time set in DAILY_TIME. # 0 to skip this. This is for users who will power off their system. # # There is a fixed max. of 14 days set, if you want to override this # change MAX_NOT_RUN_FORCE in /usr/lib/cron/run-crons MAX_NOT_RUN="5"
If you use crontab -e as a normal user you won't be able to do full backups that way because the jobs will run as that user, who does not have permission to read all files and may not even have permission to write to the backup device.
That's something that is missing in linux: the possibility of defining users with roles. A user for backup that may copy any file to a predefined backup destination, but not read them. For example. Of course, we can use sudo to allow someone to start a predefined backup job and a few things more. -- Cheers / Saludos, Carlos E. R. (from 11.2 x86_64 "Emerald" GM (Elessar))