In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to configure timed restart in Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to configure timed restart in Linux.
1. Create a new .sh file in the service directory
❝
Cd / opt/tsp/
Touch restart.sh
\ 2. View
3. Edit restart.sh script
❝
Jps-l | grep wx | awk'{print $1}'| xargs kill-9 nohup java-jar / opt/tsp/wx.jar > / opt/tsp/wx.out 2 > & 1 &
4. Explain the meaning of the script
Jps-l | grep wx (ps-ef | grep wx) query the process of wx.jar
Awk'{print $1} 'gets the first column of the process query result structure
| | xargs kill-9 kill drops the process number queried |
Nohup java-jar / opt/tsp/wx.jar > / opt/tsp/wx.out 2 > & 1 & start command
5. Write scheduled tasks, enter the editor, press the I button, and you can enter it.
\ 6. Explain the command 40 15 * * 5 sh / opt/tsp/restart.sh execute the restart.sh script at 15:40 on Friday
Write rules:
The first five bits are timed and the time period is described as follows:
The first * indicates minutes: value range: 0-59
The second * indicates the hour: value range: 0-23
The third * indicates the number of days: value range: 1-31
The fourth * indicates the month: value range 1-12
The fifth * indicates weekly: value range: 0-6
"*" represents a number in the range of values, "/" represents "every", "-" represents from a certain number to a certain number, "," separates several discrete numbers.
7. Cron service
/ sbin/service crond start/sbin/service crond stop/sbin/service crond restart/sbin/service crond reload/sbin/service crond status Thank you for your reading. The above is the content of "how to configure scheduled restart of Linux". After the study of this article, I believe you have a deeper understanding of how to configure scheduled restart of Linux, and the specific usage 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.