- 论坛徽章:
- 11
|
怎么查看和设置crontab?
crontab(C)
**********
____________________________________________________________________________
crontab -- schedule commands to be executed at regular intervals
Syntax
======
crontab [ file ]
crontab [ -e | -l | -r ]
crontab -u user [ -e | -l | -r ]
Description
===========
The crontab command can be used to schedule commands to be executed at
regular intervals. These commands are stored in the user's crontab file,
/usr/spool/cron/crontabs/username. Any output or errors generated by the
commands are mailed to the user.
If called with no options, crontab copies the specified file, or standard
input if no file is specified, into the crontabs directory. If the user has
a previous crontab file, this is replaced.
crontab understands the following options:
-e Permit the contents of the user's crontab file to be edited with the
editor specified by the EDITOR environment variable. The default
editor is vi(C). A copy of the crontab file is edited and checked
for validity before it replaces the installed crontab file.
-l List the contents of the user's crontab file.
-r Remove the user's crontab file from the crontabs directory.
-u Allow crontab to manipulate a different crontab file from invoking
users. If crontab is used from an su(C) session then crontab by
default will manipulate the crontab file of the su'ed user. The -u
option may be used to direct crontab to manipulate the original
login user's crontab file instead. root can also use the -u option
to manipulate any user's crontab file.
If the file /usr/lib/cron/cron.allow exists, only the users listed in that
file are allowed to use crontab. If cron.allow does not exist, and the file
/usr/lib/cron/cron.deny does, then all users not listed in cron.deny are
allowed access to crontab. An empty cron.deny allows global usage. If
neither file exists, only root is allowed to submit a job. The allow/deny
files consist of one user name per line.
The crontabs files consist of lines of six fields each. The fields are
separated by spaces or tabs. The first five are integer patterns that
specify the minute (0-59), hour (0-23), day of the month (1-31), month of
the year (1-12), and day of the week (0-6, with 0=Sunday). Each of these
patterns may contain:
o a number in the (respective) range indicated above
o two numbers separated by a minus (indicating an inclusive range)
o a list of numbers separated by commas (meaning all of these numbers)
o an asterisk (meaning all legal values)
Note that the specification of days may be made by two fields (day of the |
|