In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use the basic composition and configuration of Crontab in Linux". In daily operation, I believe many people have doubts about how to use the basic composition and configuration of Crontab in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to use the basic composition and configuration of Crontab in Linux". Next, please follow the editor to study!
[basic composition of Crontab]
① system Service CROND: refreshes scheduled tasks from the configuration file every minute
② configuration files: setting scheduled tasks in file mode
③ configuration tool crontab: timing task for use adjustment
[configuration file format of configuration file]
* COMMAND
The first *: 0-59 minutes means execution every minute.
The second *: 0-23 hours
Third *: date 1-31
The fourth *: month 1-12
The fifth *: week 0-7 (0 or 7 means Sunday)
Restart Apache at 21:30 every night
The code is as follows:
30 21 * service httpd restart
Restart Apache at 4:45 on the 1st, 10th and 22nd of each month
The code is as follows:
45 4 1 10 service httpd restart 22 * *
Restart Apache at 4:45 on the 1st to 10th of each month
The code is as follows:
45 4 1-10 * * service httpd restart
[example 4] restart Apache every two minutes (with no condition)
The code is as follows:
* / 2 * service httpd restart
[example 5] restart Apache in odd minutes per hour
The code is as follows:
1-59TX 2 * service httpd restart
Restart in 1 minute
(the even number is 0-58 thumb 2)
Restart Apache every 1 hour (conditional) between 11:00 and 7 a.m.
The code is as follows:
0 23-7max 1 * service httpd restart
Note: 0 for minutes, and * for any minute from 23:00 to 7 o'clock, is obviously not the result we want.
[example 7] restart Apache every 30 minutes between 18:00 and 23:00 every day (conditional)
The code is as follows:
0pr 30 18-23 * service httpd restart
Or
The code is as follows:
0-59thumb 30 18-23 * service httpd restart
[summary]
① * means match at all times
② can use "An and B" to denote An or B or C to execute commands.
③ can use "A murb" to mean execute commands between An and B.
④ can use "* / A" to indicate that the command is executed every A minute (hour, etc.)
[use of crontab tool]
Crontab help Information
The code is as follows:
Crontab-- h
Or
The code is as follows:
Crontab-help
① views the scheduled task list of a user (dee)
The code is as follows:
Crontab-l-u dee
② modifies a user's scheduled task (dee)
The code is as follows:
Crontab-e-u dee
Save exit with: wq (it seems that the Ubuntu system exit editing schedule task is a little more complicated)
③ to view the generated final scheduled task file
The code is as follows:
-/ var/spool/cron
Use
The code is as follows:
Tail-f / var/log/cron
View crontan's log
At this point, the study on "how to use the basic composition and configuration of Crontab in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.