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

vpsdime:VPS内存/2核/VPS,4G内存/2核/50gSSD/2T流量/达拉斯机房达拉斯机房,新产品系列-Windows VPS

vpsdime上了新产品系列-Windows VPS,配置依旧很高但是价格依旧是走低端线路。或许vpsdime的母公司Nodisto IT想把核心产品集中到vpsdime上吧,当然这只是站长个人的猜测,毕竟winity.io也是专业卖Windows vps的,而且也是他们自己的品牌。vpsdime是一家新上来不久的奇葩VPS提供商,实际是和backupspy以及crowncloud等都是同一家公司...

RackNerd 2022春节促销提供三款年付套餐 低至年付10.88美元

RackNerd 商家我们应该是比较熟悉的商家,速度一般,但是人家便宜且可选机房也是比较多的,较多集中在美国机房。包括前面的新年元旦促销的时候有提供年付10美元左右的方案,实际上RackNerd商家的营销策略也是如此,每逢节日都有活动,配置简单变化,价格基本差不多,所以我们网友看到没有必要囤货,有需要就选择。RackNerd 商家这次2022农历新年也是有几款年付套餐。低至RackNerd VPS...

BGPTO独服折优惠- 日本独服65折 新加坡独服75折

BGPTO是一家成立于2017年的国人主机商,从商家背景上是国内的K总和有其他投资者共同创办的商家,主营是独立服务器业务。数据中心包括美国洛杉矶Cera、新加坡、日本大阪和香港数据中心的服务器。商家对所销售服务器产品拥有自主硬件和IP资源,支持Linux和Windows。这个月,有看到商家BGPTO日本和新加坡机房独服正进行优惠促销,折扣最低65折。第一、商家机房优惠券码这次商家的活动机房是新加坡...

定时重启为你推荐
firetrap流言终结者 中的银幕神偷 和开保险柜 的流言是 取材与 那几部电影的长尾关键词挖掘工具大家是怎么挖掘长尾关键词的?www.522av.com在白虎网站bhwz.com看电影要安装什么播放器?www.vtigu.com初三了,为什么考试的数学题都那么难,我最多也就135,最后一道选择,填空啊根本没法做,最后几道大题倒www.kaspersky.com.cn卡巴斯基杀毒软件有免费的吗?稳定版的怎么找?www.idanmu.com万通奇迹,www.wcm77.HK 是传销么?ww.66bobo.com这个www.中国应急救援网.com查询证件是真是假?javlibrary.comSSPD-103的AV女主角是谁啊1!!!!求解本冈一郎本冈一郎到底有效果吗?有人用过吗?ename.com趫 是什么意思?
shopex虚拟主机 域名服务器 游戏服务器租用 服务器租用托管 视频空间租用 域名服务dns的主要功能为 域名备案只选云聚达 域名解析文件 老左 阿里云os 80vps koss gitcafe 论坛空间 韩国网名大全 阿里云浏览器 idc资讯 135邮箱 阿里校园 东莞数据中心 更多