Cron mechanism
Cron allows the system to perform a specified work at a specified time, and we can use the CRONTAB directive to manage the cron mechanism
Crontab parameters
-U: This parameter allows us to edit other people's crontab, if not add this parameter, will open their own crontab
Crontab-u User Name
-L: Can list contents of crontab
-r: Can remove crontab
-E: You can use the System Preset editor to turn on crontab
-I: Can remove the crontab, will jump out of the system information to let you again determine whether to remove crontab
Crontab Time Format Description
Minute (min) can set 0-59 points
Hour (hours) can be set for 0-23 hours
Day of month (date) can be set to number 1-31
Month: You can set the January-December
Day of Week (week): Can be set to 0-7 weeks, where 0 and 7 both represent Sunday, or we can use the name to represent Sunday to Monday, such as sun for Sunday, Mon for Monday, etc.
Crontab Time Format Example
1-3 means 123
1-9/2 says 13579
crontab Example
Execute */5 every five minutes * * * *
Executes 0 per hour * * * *
Executes 0 0 * * * per day
Weekly Execution 0 0 * 0
Monthly execution 0 0 1 * *
Annual Execution 0 0 1 1 *
Set permissions for Cron
/etc/cron.allow
/etc/cron.deny
The system first determines whether there is a cron.allow this file, if there is a file, the system will determine if the user is in the Cron.allow list, if in the list, you can use the cron mechanism. If the user is not on the Cron.allow list, then the cron mechanism cannot be used.
If the system does not cron.allow this file, the system will again determine whether there is cron.deny this file, if there is cron.deny this file, it will be judged that the user is not in the Cron.deny this list, if the user in the Cron.deny list, will You cannot use the cron mechanism. If the user is not on the Cron.deny list, you can use the cron mechanism.
If none of the two files in the system is available, you can use the cron mechanism
Introducing the Crontab file
/etc/crontab
In this file, there is no record of what the system is doing, but the following four subdirectories are recorded.
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
These subdirectories contain scripts that, at the point of time specified by Crontab, execute the scripts in those subdirectories.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.