1CRONTAB(1) General Commands Manual CRONTAB(1)
2
3
4
6 crontab - maintains crontab files for individual users
7
9 crontab [-u user] file
10 crontab [-u user] [-l | -r | -e] [-i] [-s]
11 crontab -n [ hostname ]
12 crontab -c
13
15 Crontab is the program used to install, remove or list the tables used
16 to serve the cron(8) daemon. Each user can have their own crontab, and
17 though these are files in /var/spool/, they are not intended to be
18 edited directly. For SELinux in MLS mode, you can define more crontabs
19 for each range. For more information, see selinux(8).
20
21 In this version of Cron it is possible to use a network-mounted shared
22 /var/spool/cron across a cluster of hosts and specify that only one of
23 the hosts should run the crontab jobs in the particular directory at
24 any one time. You may also use crontab(1) from any of these hosts to
25 edit the same shared set of crontab files, and to set and query which
26 host should run the crontab jobs.
27
28 Running cron jobs can be allowed or disallowed for different users. For
29 this purpose, use the cron.allow and cron.deny files. If the
30 cron.allow file exists, a user must be listed in it to be allowed to
31 use cron If the cron.allow file does not exist but the cron.deny file
32 does exist, then a user must not be listed in the cron.deny file in
33 order to use cron. If neither of these files exists, only the super
34 user is allowed to use cron. Another way to restrict access to cron is
35 to use PAM authentication to set up users, which are allowed or disal‐
36 lowed to use crontab or modify system cron jobs in the /etc/cron.d/
37 directory.
38
39 The temporary directory can be set in an environment variable. If it is
40 not set by the user, the /tmp directory is used.
41
43 -u Appends the name of the user whose crontab is to be modified.
44 If this option is not used, crontab examines "your" crontab,
45 i.e., the crontab of the person executing the command. Note
46 that su(8) may confuse crontab, thus, when executing commands
47 under su(8) you should always use the -u option. If no crontab
48 exists for a particular user, it is created for him the first
49 time the crontab -u command is used under his username.
50
51 -l Displays the current crontab on standard output.
52
53 -r Removes the current crontab.
54
55 -e Edits the current crontab using the editor specified by the VIS‐
56 UAL or EDITOR environment variables. After you exit from the
57 editor, the modified crontab will be installed automatically.
58
59 -i This option modifies the -r option to prompt the user for a
60 'y/Y' response before actually removing the crontab.
61
62 -s Appends the current SELinux security context string as an
63 MLS_LEVEL setting to the crontab file before editing / replace‐
64 ment occurs - see the documentation of MLS_LEVEL in crontab(5).
65
66 -n This option is relevant only if cron(8) was started with the -c
67 option, to enable clustering support. It is used to set the
68 host in the cluster which should run the jobs specified in the
69 crontab files in the /var/spool/cron directory. If a hostname
70 is supplied, the host whose hostname returned by gethostname(2)
71 matches the supplied hostname, will be selected to run the
72 selected cron jobs subsequently. If there is no host in the
73 cluster matching the supplied hostname, or you explicitly spec‐
74 ify an empty hostname, then the selected jobs will not be run at
75 all. If the hostname is omitted, the name of the local host
76 returned by gethostname(2) is used. Using this option has no
77 effect on the /etc/crontab file and the files in the /etc/cron.d
78 directory, which are always run, and considered host-specific.
79 For more information on clustering support, see cron(8).
80
81 -c This option is only relevant if cron(8) was started with the -c
82 option, to enable clustering support. It is used to query which
83 host in the cluster is currently set to run the jobs specified
84 in the crontab files in the directory /var/spool/cron , as set
85 using the -n option.
86
88 crontab(5),cron(8)
89
91 /etc/cron.allow
92 /etc/cron.deny
93
95 The crontab command conforms to IEEE Std1003.2-1992 (``POSIX''). This
96 new command syntax differs from previous versions of Vixie Cron, as
97 well as from the classic SVR3 syntax.
98
100 An informative usage message appears if you run a crontab with a faulty
101 command defined in it.
102
104 Paul Vixie <vixie@isc.org>
105 Colin Dean <colin@colin-dean.org>
106
107
108
109 22 September 2010 CRONTAB(1)