Sunday, December 24, 2017

Linux crontab command

The crontab (short for "cron table") is a list of commands that are scheduled to run at regular time intervals on your computer system. The crontab command opens the crontab for editing, and lets you add, remove, or modify scheduled tasks.
The daemon which reads the crontab and executes the commands at the right time is called cron. It's named after Kronos, the Greek god of time

Command syntax

crontab [-u user] file
crontab [-u user] [-l | -r | -e] [-i] [-s]
Options
fileLoad the crontab data from the specified file. If file is a dash ("-"), the crontab data is read from standard input.
-u userSpecifies the user whose crontab is to be viewed or modified. If this option is not given, crontab opens the crontab of the user who ran crontab. Note: using su to switch users can confuse crontab, so if you are running it inside of su, always use the -u option to avoid ambiguity.
-lDisplay the current crontab.
-rRemove the current crontab.
-eEdit the current crontab, using the editor specified in the environment variable VISUALor EDITOR.
-iSame as -r, but gives the user a yes/no confirmation prompt before removing the crontab.
-sSELinux only: appends the current SELinux security context string as an MLS_LEVELsetting to the crontab file before editing or replacement occurs. See your SELinux documentation for detailed information.
Find more details here: ucrontab

No comments:

Post a Comment

5 Strategies for Getting More Work Done in Less Time

Summary.    You’ve got more to do than could possibly get done with your current work style. You’ve prioritized. You’ve planned. You’ve dele...