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

GigsGigsCloud(年付26美元)国际线路美国VPS主机

已经有一段时间没有听到Gigsgigscloud服务商的信息,这不今天看到商家有新增一款国际版线路的美国VPS主机,年付也是比较便宜的只需要26美元。线路上是接入Cogentco、NTT、AN2YIX以及其他亚洲Peering。这款方案的VPS主机默认的配置是1Gbps带宽,比较神奇的需要等待手工人工开通激活,不是立即开通的。我们看看这款服务器在哪里选择看到套餐。内存CPUSSD流量价格购买地址1...

HTTPS加密协议端口默认是多少且是否支持更换端口访问

看到群里网友们在讨论由于不清楚的原因,有同学的网站无法访问。他的网站是没有用HTTPS的,直接访问他的HTTP是无法访问的,通过PING测试可以看到解析地址已经比较乱,应该是所谓的DNS污染。其中有网友提到采用HTTPS加密证书试试。因为HTTP和HTTPS走的不是一个端口,之前有网友这样测试过是可以缓解这样的问题。这样通过将网站绑定设置HTTPS之后,是可以打开的,看来网站的80端口出现问题,而...

Sharktech($49/月),10G端口 32GB内存,鲨鱼机房新用户赠送$50

Sharktech 鲨鱼机房商家我们是不是算比较熟悉的,因为有很多的服务商渠道的高防服务器都是拿他们家的机器然后部署高防VPS主机的,不过这几年Sharktech商家有自己直接销售云服务器产品,比如看到有新增公有云主机有促销活动,一般有人可能买回去自己搭建虚拟主机拆分销售的,有的也是自用的。有看到不少网友在分享到鲨鱼机房商家促销活动期间,有赠送开通公有云主机$50,可以购买最低配置的,$49/月的...

定时重启为你推荐
金评媒朱江喜剧明星“朱江”的父亲叫什么?刘祚天DJ这个职业怎么样?avtt4.comwww.51kao4.com为什么进不去啊?www.ijinshan.com桌面上多了一个IE图标,打开后就链接到009dh.com这个网站,这个图标怎么删掉啊?机器蜘蛛尼尔机械纪元机械蜘蛛怎么过 机械蜘蛛打法攻略解析www.gogo.com祺笑化瘀祛斑胶囊效果。www.diediao.com这是什么电影月风随笔享受生活作文600字查看源代码怎样查看程序的源代码韩宫窥春临窗晓月窥残梦求下联,要求工整,不出绿
长沙域名注册 重庆服务器租用 韩国vps sugarsync omnis 68.168.16.150 免费cdn加速 sockscap 美国php空间 dropbox网盘 湖南服务器托管 小米数据库 ca4249 合租空间 域名和空间 服务器硬件防火墙 web服务器搭建 四川电信商城 深圳域名 hdroad 更多