CRONTAB(1)
okay bestie, buckle up โ this is CRONTAB(1), the User Commands page for crontab, and it's literally the keeper of your cron files. ๐
โจ
๐ธ NAME ๐ธ
crontab โ maintains crontab files for individual users.
โจ SYNOPSIS โจ
crontab [-u user] <file | ->
crontab [-T] <file | ->
crontab [-u user] <-l | -r | -e> [-i] [-s]
crontab -n [ hostname ]
crontab -c
crontab -V
๐ DESCRIPTION ๐
crontab is the program you use to install a crontab table file, remove or list the existing tables that serve the cron(8) daemon. Every user can have their own crontab, and even though these are files in /var/spool/, they are not intended to be edited directly. For SELinux in MLS mode, you can define more crontabs for each range โ for more info, see selinux(8). ๐ฆ
In this version of Cron it's possible to use a network-mounted shared /var/spool/cron across a cluster of hosts and specify that only one of the hosts should run the crontab jobs in the particular directory at any one time. You may also use crontab from any of these hosts to edit the same shared set of crontab files, and to set and query which host should run the crontab jobs. cluster girlies rise ๐
Scheduling cron jobs with crontab can be allowed or disallowed for different users. For this purpose, use the cron.allow and cron.deny files. If the cron.allow file exists, a user must be listed in it to be allowed to use crontab. If the cron.allow file does not exist but the cron.deny file does exist, then a user must not be listed in the cron.deny file in order to use crontab. If neither of these files exist, then only the super user is allowed to use crontab. ๐
Another way to restrict the scheduling of cron jobs beyond crontab is to use PAM authentication in /etc/security/access.conf to set up users, which are allowed or disallowed to use crontab or modify system cron jobs in the /etc/cron.d/ directory. ๐ซถ
The temporary directory can be set in an environment variable. If it is not set by the user, the /tmp directory is used. ๐
When listing a crontab on a terminal the output will be colorized unless an environment variable NO_COLOR is set. ๐
On edition or deletion of the crontab, a backup of the last crontab will be saved to $XDG_CACHE_HOME/crontab/crontab.bak or $XDG_CACHE_HOME/crontab/crontab.<user>.bak if -u is used. If the XDG_CACHE_HOME environment variable is not set, $HOME/.cache will be used instead. ๐
๐ OPTIONS ๐
-uโ Specifies the name of the user whose crontab is to be modified. If this option is not used,crontabexamines โyourโ crontab, i.e., the crontab of the person executing the command. If no crontab exists for a particular user, it is created for them the first time thecrontab -ucommand is used under their username. ๐-Tโ Test the crontab file syntax without installing it. Once an issue is found, the validation is interrupted, so this will not return all the existing issues at the same execution. โ ๏ธ-lโ Displays the current crontab on standard output. ๐บ-rโ Removes the current crontab. ๐-eโ Edits the current crontab using the editor specified by theVISUALorEDITORenvironment variables. After you exit from the editor, the modified crontab will be installed automatically. โ๏ธ-iโ This option modifies the-roption to prompt the user for ay/Yresponse before actually removing the crontab. ๐-sโ Appends the current SELinux security context string as anMLS_LEVELsetting to the crontab file before editing / replacement occurs โ see the documentation ofMLS_LEVELincrontab(5). ๐ฆ-nโ This option is relevant only ifcron(8)was started with the-coption, to enable clustering support. It is used to set the host in the cluster which should run the jobs specified in the crontab files in the/var/spool/crondirectory. If a hostname is supplied, the host whose hostname returned bygethostname(2)matches the supplied hostname, will be selected to run the selected cron jobs subsequently. If there is no host in the cluster matching the supplied hostname, or you explicitly specify an empty hostname, then the selected jobs will not be run at all. If the hostname is omitted, the name of the local host returned bygethostname(2)is used. Using this option has no effect on the/etc/crontabfile and the files in the/etc/cron.ddirectory, which are always run, and considered host-specific. For more information on clustering support, seecron(8). ๐-cโ This option is only relevant ifcron(8)was started with the-coption, to enable clustering support. It is used to query which host in the cluster is currently set to run the jobs specified in the crontab files in the directory/var/spool/cron, as set using the-noption. ๐-Vโ Print version and exit. โญ
๐ CAVEATS ๐
The files cron.allow and cron.deny cannot be used to restrict the execution of cron jobs; they only restrict the use of crontab. In particular, restricting access to crontab has no effect on an existing crontab of a user. Its jobs will continue to be executed until the crontab is removed. ๐ญ
The files cron.allow and cron.deny must be readable by the user invoking crontab. If this is not the case, then they are treated as non-existent. ๐ซ
๐ SEE ALSO ๐
๐ FILES ๐
/etc/cron.allow/etc/cron.deny
๐ STANDARDS ๐
The crontab command conforms to IEEE Std1003.2-1992 (POSIX) with one exception: For replacing the current crontab with data from standard input the - has to be specified on the command line if the standard input is a TTY. This new command syntax differs from previous versions of Vixie Cron, as well as from the classic SVR3 syntax. ๐
๐ฉบ DIAGNOSTICS ๐ฉบ
An informative usage message appears if you run a crontab with a faulty command defined in it. ๐จ
๐ AUTHOR ๐
- Paul Vixie
- Colin Dean
xoxo, your cronie bestie ๐ โ page CRONTAB(1), source/version cronie, dated 2019-10-29. slay responsibly, bestie ๐โจ
๐ฆ where this page comes from
- alpine 3.24: cronie-doc 1.7.2-r1 ยท ISC
- arch rolling: cronie 1.7.2-2 ยท custom:BSD
- centos-stream 10: cronie 1.7.0-15.el10 ยท GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND ISC AND LGPL-2.1-or-later
- fedora 43: cronie 1.7.2-12.fc43 ยท GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND ISC AND LGPL-2.1-or-later
- fedora 44: cronie 1.7.2-16.fc44 ยท GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND ISC AND LGPL-2.1-or-later
- nixpkgs unstable: cronie 1.7.2
- opensuse-leap 16.0: cronie 1.7.2-160000.2.2 ยท BSD-3-Clause AND GPL-2.0-only AND MIT
- opensuse-leap 16.0: cronie 1.7.2-160000.2.2 ยท BSD-3-Clause AND GPL-2.0-only AND MIT
- opensuse-leap 16.0: cronie 1.7.2-160000.2.2 ยท BSD-3-Clause AND GPL-2.0-only AND MIT
- opensuse-leap 16.0: cronie 1.7.2-160000.2.2 ยท BSD-3-Clause AND GPL-2.0-only AND MIT
- Copyright 1988,1990,1993 by Paul Vixie
- Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- Copyright (c) 1997,2000 by Internet Software Consortium, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms