重启linux系统定时重启(Timing reboot of Linux system)

定时重启  时间:2021-03-18  阅读:()

linux系统定时重启Timing reboot of Linux systemEmployed

Automatic restart at 1 a.m. every month at 3 a.m.

Steps are as follows:

1, login with root account;

2. Open the terminal window;

3, input "crontab -e""

4, press the Insert key.

5, enter "031 * * reboot""

6, press the ESC key.

7, input ": WQ", and then enter.

The above input can be checked through the"crontab-l" command.Data interchange for trade

Automatic restart at 3 a.m. every Monday

1, login with root account;

2. Open the terminal window;

3, input "crontab -e""

4, press the Insert key.

5, enter "03 * * 1 reboot""

6, press the ESC key.

7, input ": WQ", and then enter.

The above input can be checked through the"crontab-l" command.Timing reboot of Linux system

After using the SSH tool to successfully login the background,run the following command:

Crontab -e

Then insert the following content in the document as required:04***/sbin/reboot (04 means restart at four a.m. every day. . .03 means 3 a.m. . . )

After the WQ is saved, the following command is executed torestart the crond service

/etc/rc.d/init.d/crond stop

/etc/rc.d/init.d/crond start

Set up every Sunday morning zero 4 restart

04 * * sun /sbin/reboot

The first one is minutes

The second one is the hour

The third is the date

The fourth is the month

The fifth is week (0-6)

Linux timing reboot

Linux timing task system Cron entry (turn)

Just made a backup module, and then the teacher prompted thebest to add an automatic backup function, so study the Cronservice to come. Cron is a built-in service for Linux, but itdoes not automatically up and start and close this service inthe following way:

/sbin/service crond start / / start service

/sbin/service crond stop / / close service

/sbin/service crond restart / / restart service

/sbin/service crond reload / / reload configuration

You can also start this service automatically when the systemis started:

Add it to the end of the script at /etc/rc.d/rc. local:/sbin/service crond start

Now the Cron service is already in the process, we can use thisservice, Cron services provide the following interfaces foreveryone to use:

1. edit directly with the crontab command

The cron service provides the crontab command to set up the cronservice. Here are some of the parameters and instructions forthis command:

Crontab -u // set a user' s cron service, root users need thisparameter when executing this command.

Details of crontab -l / a cron service user list

Crontab -r / / delete no users cron service

Crontab -e / / edit a user' s cron service

For example, root looks at your own cron settings: crontab -uroot -l

For example, root wants to delete the Fred settings for cron:

crontab -u Fred -r

When editing the cron service, there are some formats andconventions for the editor, input: crontab -u root -eEntering the VI editing mode, the content of the editor mustconform to the following format: */1 * * * * ls > /tmp/ls.txtA part of this format is the time setting, the back part is thecommand to execute the command to execute, if too much, can putthese commands into a script, then here directly call thisscript can be invoked, remember to write the full path to thelife. Time setting we have a certain agreement, the first fivenumbers on behalf of five numbers, the number of values andmeaning are as follows:

M i nu t e s (0-59)

Hour (0-23)

Date (1-31)

Month (1-12)

The week (0-6) //0 stands for Sunday

In addition to digital and some special symbols is "*" and "/"and "-", "*", representing the range of all the numbers, "/"representative of eachmeaning, "*/5" said each of the 5 units,"-" representatives from a number to a number, ", " separateseveral discrete numbers. Here are a few examples of the

problem:

At 6 a.m. every morning

06 * * * echo "Good morning. /tmp/test.txt" > > / / / / echoonly, do not see any output from the screen, because the cronoutput email to root any mail.

Every two hours

0 */2 * * * echo "Have a break now. " /tmp/test.txt

Between 11 in the evening and 8 in the morning, every two hours,eight a.m.

0 23-7/2, 8 * * * echo "Have a good dream:" /tmp/test. txt4 of the month and 11 Monday of each week to Wednesday morning0114 * 1-3 command line

At 4 a.m. in January 1st

0411 * command l ine

Every time you finish editing a user' s cron settings, cronautomatically generates a user with the same name in the/var/spool/cron file, the user' s cron information is recordedin the file, the file can not be edited directly, can onlyusecrontab -e to edit. After the cron starts, read the file onceevery clock and check if it' s going to execute the commands.

Therefore, this file does not need to restart the cron serviceafter modification.

2. edit /etc/crontab file configure Cron

Cron services not only read all the files in /var/spool/crononce a minute, but also read /etc/crontab once, so we canconfigure this file to do some things using Cron services. Thecrontab configuration is for one user, and editing the/etc/crontab is for the system task. The file format of thisfile is:

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root / / if an error occurs, or the data output, dataas a mail sent to this account

The path HOME=/ / / users run, here is the root directory# run-parts

01****root run-parts/etc/cron.hourly//per hour performedwithin the /etc/cron.hourly script

024 * * * root run-parts /etc/cron.daily / / day performedwithin the /etc/cron.daily script

224*0*root run-parts/etc/cron.weekly//per week performedwithin the /etc/cron.weekly script

4241**root run-parts/etc/cron.monthly///etc/cron.monthlyto execute the script within a month

Notice the "run-parts" parameter, and if you remove thisparameter, you can write a script name that you want to run,instead of the folder name.

It' s actually modifying the /etc/crontab file

224 * * 0 root /sbin/reboot

RackNerd提供四款高配美国服务器促销活动低至月$189

RackNerd 商家给的感觉就是一直蹭节日热点,然后时不时通过修改配置结构不断的提供低价年付的VPS主机,不过他们家还是在做事的,这么两年多的发展,居然已经有新增至十几个数据中心,而且产品线发展也是比较丰富。比如也有独立服务器业务,不过在他们轮番的低价年付VPS主机活动下,他们的服务器估摸着销路不是太好的。这里,今天有看到RackNerd商家的独立服务器业务有促销。这次提供美国多个机房的高配独立...

spinservers:10Gbps带宽高配服务器月付89美元起,达拉斯/圣何塞机房

spinservers是一家主营国外服务器租用和Hybrid Dedicated等产品的商家,Majestic Hosting Solutions LLC旗下站点,商家数据中心包括美国达拉斯和圣何塞机房,机器一般10Gbps端口带宽,且硬件配置较高。目前,主机商针对达拉斯机房机器提供优惠码,最低款Dual E5-2630L v2+64G+1.6TB SSD月付89美元起,支持PayPal、支付宝等...

UCloud:全球大促降价,云服务器全网最低价,1核1G快杰云服务器47元/年

ucloud:全球大促活动降价了!这次云服务器全网最低价,也算是让利用户了,UCloud商家调低了之前的促销活动价格,并且新增了1核1G内存配置快杰型云服务器,价格是47元/年(也可选2元首月),这是全网同配置最便宜的云服务器了!UCloud全球大促活动促销机型有快杰型云服务器和通用型云服务器,促销机房国内海外都有,覆盖全球20个城市,具体有北京、上海、广州、香港、 台北、日本东京、越南胡志明市、...

定时重启为你推荐
金评媒朱江汪涵在沈阳7进5朱江和巩贺PK完说了句什么啊?安徽汽车网安徽省各地车牌号简称是按照什么顺序排的罗伦佐娜维洛娜毛周角化修复液治疗毛周角化有用吗?谁用过?能告诉我吗?百花百游百花百游的五滴自游进程同ip网站一个域名能对应多个IP吗www.228gg.comwww.a8tb.com这个网站该如何改善www.03ggg.comwww.tvb33.com这里好像有中国性戏观看吧??javbibibibi直播是真的吗javbibi日文里的bibi是什么意思www.ijinshan.com驱动人生是电脑自带的还是要安装啊!?在哪里呢?没有找到
查询域名 鲁诺vps directspace qq数据库 圣诞促销 国外免费全能空间 adroit 免费美国空间 100mbps 支持外链的相册 安徽双线服务器 中国电信网络测速 西安主机 可外链的相册 存储服务器 万网服务器 移动王卡 google搜索打不开 register.com ipower 更多