4.12 crontab: set the timer
Purpose: The crontab command is used to install, delete, or list the task tables used to drive cron background processes. Then, the configuration is executed by the cron daemon at the specified time.
Usage: crontab [-u user] File
Or crontab [-u user] {-E |-L |-r}
The main options are as follows.
--E: run the text editor to set the time table. The default text editor is vi.
--R: Delete the current time table.
--L: list the current time series tables.
-[-U user]: Specifies the user name to be set.
Crontab file usage: minute hour day month dayofweek command
Minute -- Minute, 0 ~ Any integer between 59. Hour -- hour, 0 ~ Any integer between 23. Day -- date, 1 ~ Any integer between 31 (if the month is specified, it must be the valid date of the month ). Month -- month, 1 ~ Any integer between 12 (or abbreviated month, such as Jan and FEB ). Dayofweek-week, 0 ~ Any integer between 7. Here, 0 or 7 represents Sunday (or use the abbreviation of the week, such as Sun and Mon ). Command-the command to be executed (it can be a command such as ls or a self-compiled script .)
The application example is as follows.
Set a scheduled and scheduled system prompt:
# Crontab-e
In this case, the system will open a VI editor. If you enter 35 17 ** 5 wall, "rest tomorrow, pay attention to backing up the database", and then save the disk and exit. In this case, a CAO file is generated in the/var/spool/cron/directory. The content is as follows:
# Do not edit this file-edit the master and reinstall.
#(/Tmp/crontab.2707 installed on Thu jan1 22:01:51 2004)
# (Cron version -- $ ID: crontab. C, V 2.13 1994/01/17 03:20:37 vixie exp $)
35 17 ** 5 wall "rest tomorrow, pay attention to backing up the database"
In this way, every Friday (), the system will display a screen reminding us to pay attention to backing up the database. The result is 4-2.
Figure 4-2 a scheduled and scheduled system prompt
Title: Fast query of Linux core application commands
Author: Cao jianghua,Edited by Fang Jianguo
ISBN: 978-7-121-11149-5
Publication date: 2010Year7Month
Pricing:59.00RMB
Start: 16Open
Page number: 528Page
Internal Capacity Simplified Introduction
After more than a decade of development, the Linux operating system has been continuously improved and more applications have been made. Now, Linux Desktop is relatively mature, but the command line technology is still the core technology of Linux.
This book introduces the functions, syntaxes, options, typical application instances, and precautions of core management commands (including the latest virtualization management commands and SELinux management commands) under Linux Command lines, every command is described in detail and a large number of instances are described. This gives readers a quick and in-depth understanding of commands in Linux. The book is classified according to the functions of Linux commands for readers to query. Before reading this book, you do not need to have too much background knowledge, whether you are a Unix user, a new linux user, or even a Windows user who has never been in touch with Linux, you can easily understand and master the content, and quickly understand and use the Linux system of each release. This book uses the commands involved in RHEL 5.5 and also applies to other Linux distributions. It is a required reference for all Linux users.
Related serialization:
Linux core application command quick query serialized eight: Kill: Killing Processes
Linux core application command quick query serialized eight: BG: Running commands in the background
Linux core application command quick query serialization 6: Batch: execute commands when the system load level permits
Linux core application command quick query: ATQ: displays the command queues to be executed after the AT command is used.
Linux core application command quick query: at: scheduled Run Command
Linux core application command quick query: SA: Reports, cleans up, and maintains process statistical files
Linux core application command quick query serialization 2: lastcomm: displays information about previously used commands
Linux core command speed query: accton: Process statistics on enabling or disabling