重启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

酷锐云香港(19元/月) ,美国1核2G 19元/月,日本独立物理机,

酷锐云是一家2019年开业的国人主机商家,商家为企业运营,主要销售主VPS服务器,提供挂机宝和云服务器,机房有美国CERA、中国香港安畅和电信,CERA为CN2 GIA线路,提供单机10G+天机盾防御,提供美国原生IP,支持媒体流解锁,商家的套餐价格非常美丽,CERA机房月付20元起,香港安畅机房10M带宽月付25元,有需要的朋友可以入手试试。酷锐云自开业以来一直有着良好的产品稳定性及服务态度,支...

Sharktech云服务器35折年付33美元起,2G内存/40G硬盘/4TB流量/多机房可选

Sharktech又称SK或者鲨鱼机房,是一家主打高防产品的国外商家,成立于2003年,提供的产品包括独立服务器租用、VPS云服务器等,自营机房在美国洛杉矶、丹佛、芝加哥和荷兰阿姆斯特丹等。之前我们经常分享商家提供的独立服务器产品,近期主机商针对云虚拟服务器(CVS)提供优惠码,优惠后XS套餐年付最低仅33.39美元起,支持使用支付宝、PayPal、信用卡等付款方式。下面以XS套餐为例,分享产品配...

特网云-新上线香港五区补货资源充足限时抢 虚拟主机6折,低至38元!

官方网站:点击访问特网云官网活动方案:===========================香港云限时购==============================支持Linux和Windows操作系统,配置都是可以自选的,非常的灵活,宽带充足新老客户活动期间新购活动款产品都可以享受续费折扣(只限在活动期间购买活动款产品才可享受续费折扣 优惠码:AADE01),购买折扣与续费折扣不叠加,都是在原价...

定时重启为你推荐
急救知识纳入考试应急救护知识应该由哪个部门培训刘祚天你们知道21世纪的DJ分为几种类型吗?(答对者重赏)同一服务器网站一个服务器放多个网站怎么设置?铂金血痕身上血痕怎么回事bihaiyinsha碧海银沙的网络像册空间好不好bihaiyinsha碧海银沙中国十大网页?b.faloo.com坏蛋是这样炼成的2出的最快的网站是那个?惠丰吧毕节医药高等专科可以专升本吗www.1100.com诺亚洲1100怎么下电影长房娇为什么我的乳晕颜色会越来越深呢?
韩国服务器租用 域名服务器上存放着internet主机的 openv Hello图床 新世界电讯 2017年黑色星期五 好玩的桌面 电子邮件服务器 秒杀预告 qq云端 工信部网站备案查询 主机返佣 成都主机托管 腾讯数据库 umax cdn免备案空间 paypal登陆 内存 nano sockscap下载 更多