On 8/17/2010 1:05 PM, Bob Williams wrote:
Hi,
What is the correct way to edit the system crontab file? I know I've done it in the past, because I have /etc/crontab which contains all my backup routines. Is it permissible to edit it with any editor (eg. vim, kate), as root?
I've tried issuing
~ # crontab -e
but that just creates a new, blank file.
I think I'm getting too old for this :(
Bob
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. 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. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org