In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to achieve timing shutdown under linux". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve timing shutdown under linux".
Just use the crontab command. Let's take a look at its detailed usage.
Name: crontab
Permissions: all users
Mode of use:
Crontab [- u user] file
Crontab [- u user] {- l |-r |-e}
Description:
Crontab is used to allow users to execute programs at fixed times or at regular intervals, in other words, similar to the user's schedule. -u user means to set a schedule that specifies user, which requires that you have permission (such as root) to specify someone else's schedule. If you don't use-u user, it means to set your own schedule.
Number of meals:
-e: execute a text editor to set the schedule. The internal text editor is VI. If you want to use another text editor, please set the VISUAL environment variable to specify which text editor to use (for example, setenv VISUAL joe).
-r: delete the current schedule
-l: list the current schedule
The format of the schedule is as follows:
F1 f2 f3 f4 f5 program
Where F1 represents minutes, f2 represents hours, f3 represents the day of a month, f4 represents a month, and f5 represents the day of a week. Program represents the program to be executed.
When F1 is *, it means that every minute will be executed. If program,f2 is *, the program will be executed every hour, and so on.
When F1 is aMub, it will be executed from minute a to minute b, and when f2 is amelb, it will be executed from hour a to hour b, and so on.
When F1 is * / n, it is executed every n minutes, f2 is * / n, it is executed every n hours, and so on.
When F1 is a, b, c. It means a, b, c, etc. Minutes to be executed, f2 is a, b, c. It means a, b, c. Hours to execute, other analogies
Users can also store all the settings in the file file and set the schedule in the way of crontab file.
Example:
Execute / bin/ls once a month at the 0th minute of every hour:
0 7 * / bin/ls
/ usr/bin/backup is performed every 20 minutes from 6 a.m. to 12:00 every December:
0 6-12 beat 3 * 12 * / usr/bin/backup
Send a letter to alex@domain.name at 5:00 every day from Monday to Friday:
0 17 * 1-5 mail-s "hi" alex@domain.name
< /tmp/maildata 每月每天的午夜 0 点 20 分, 2 点 20 分, 4 点 20 分....执行 echo "haha" 20 0-23/2 * * * echo "haha" 注意 : 当程序在你所指定的时间执行后,系统会寄一封信给你,显示该程序执行的内容,若是你不希望收到这样的信,请在每一行空一格之后加上 >/ dev/null 2 > & 1 is fine.
Thank you for reading, the above is the content of "how to achieve timing shutdown under linux". After the study of this article, I believe you have a deeper understanding of how to achieve timing shutdown under linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.