Adding crontab Entries (Unix Power Tools, 3rd Edition)
25.3. Adding crontab Entries
For a good tip on silencing cron job mailings,
see Section 25.6.
Most recent
versions of Unix have a special command for maintaining the
crontab file. To create a new
crontab file, create a file containing the
desired crontab entries. Then run the
crontab command to install the file in the
cron spool area. For example, if user
chavez executes the command below, the file
mycron will be installed as
/usr/spool/cron/crontabs/chavez:
$ crontab mycron
If chavez had previously installed
crontab entries, they will be
replaced by those in
mycron; thus, any current entries that
chavez wishes to keep must also be present in
mycron.
The -l option to crontab lists
the current crontab entries, and redirecting its
output to a file will allow them to be captured and edited:
$ crontab -l >mycron
$ vi mycron
$ crontab mycron
The
-r option will remove all current
crontab entries. Many versions of the
crontab have an additional -e
option that lets you directly edit your current
crontab entries in a single step.
On original BSD-based Unix implementations, there is no separate
crontab command, nor does each user get a personal
crontab file. It does distinguish between
" global"
crontab entries (in
/usr/lib/crontab) and
"local" entries (in
/usr/lib/crontab.local) -- however, you have
to edit these files directly, which will probably require you to
become superuser. It's a good idea to collect
personal and site-specific crontab entries in
the
crontab.local file.
-- AF, from Essential System
Administration (O'Reilly,
2002)
25.2. Periodic Program Execution: The cron Facility25.4. Including Standard Input Within a cron Entry
Copyright © 2003 O'Reilly & Associates. All rights reserved.
Wyszukiwarka
Podobne podstrony:
ch25ch25 (4)ch25 (9)CH25 (11)ch25ch25ch25 (2)ch25 (10)ch25ch25ch25 (8)ch25ch25ch25ch25ch25ch25 (5)więcej podobnych podstron