Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use crontab to set timing restart in CentOS

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to use crontab settings in CentOS to restart regularly. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

1. Configure a feature that restarts automatically every day:

If crontab is supported, you can directly crontab-l to view the existing scheduled tasks.

If the current linux does not support crontab, it needs to be configured:

# install Crontab yum install vixie-cron crontabs#, set boot, start Crontab chkconfig crond on#, start Crontab service crond start

Let's take a look at the existing Crontab:

Crontab-l

Prompt is no crontab for root

Nothing, so add one:

Edit commands:

Crontab-e

Press I to enter edit mode, enter

30 15 * root / sbin/reboot

Means to restart the device at 15:30 every afternoon. Press ESC to enter command mode and enter: wq to save and exit.

Finally, restart crontab to make the restart function effective.

Service crond restart

Let's call it a day!

Add: Crontab basic format: * * command hourly, day, month and week command column 1 represents minutes 1: 59 per minute or / 1 indicates hours 1: 23 (0 = 0 o'clock). Column 3 represents date 1: 31 column 4 represents month 1: 12, column 5, identification number week 0: 6 (0 means Sunday) column 6 summary The command that runs is how to set a scheduled restart in CentOS using crontab. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report