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

IntoVPS:按小时计费KVM月费5美元起($0.0075/小时),6个机房可选

IntoVPS是成立于2004年的Hosterion SRL旗下于2009年推出的无管理型VPS主机品牌,商家提供基于OpenStack构建的VPS产品,支持小时计费是他的一大特色,VPS可选数据中心包括美国弗里蒙特、达拉斯、英国伦敦、荷兰和罗马尼亚等6个地区机房。商家VPS主机基于KVM架构,最低每小时0.0075美元起($5/月)。下面列出几款VPS主机配置信息。CPU:1core内存:2GB...

A400互联1H/1G/10M/300G流量37.8元/季

A400互联是一家成立于2020年的商家,本次给大家带来的是,全新上线的香港节点,cmi+cn2线路,全场香港产品7折优惠,优惠码0711,A400互联,只为给你提供更快,更稳,更实惠的套餐。目前,商家推出香港cn2节点+cmi线路云主机,1H/1G/10M/300G流量,37.8元/季,云上日子,你我共享。A400互联优惠码:七折优惠码:0711A400互联优惠方案:适合建站,个人开发爱好者配置...

SugarHosts糖果主机六折 云服务器五折

也有在上个月介绍到糖果主机商12周年的促销活动,我有看到不少的朋友还是选择他们家的香港虚拟主机和美国虚拟主机比较多,同时有一个网友有联系到推荐入门的个人网站主机,最后建议他选择糖果主机的迷你主机方案,适合单个站点的。这次商家又推出所谓的秋季活动促销,这里一并整理看看这个服务商在秋季活动中有哪些值得选择的主机方案,比如虚拟主机最低可以享受六折,云服务器可以享受五折优惠。 官网地址:糖果主机秋季活动促...

定时重启为你推荐
留学生认证国外留学生毕业证怎么进行认证呢?巨星prince去世Whitney Houston因什么去世的?百度关键词价格查询百度关键字如何设定竟价价格?地陷裂口天上顿时露出一个大窟窿地上也裂开了,一到黑幽幽的深沟可以用什么四字词语来?百度关键词分析百度关键字分析是什么意思?www.55125.cnwww95599cn余额查询m.kan84.net电视剧海派甜心全集海派甜心在线观看海派甜心全集高清dvd快播迅雷下载www.kknnn.com求有颜色的网站!要免费的m88.comwww.m88.com现在的官方网址是哪个啊 ?www.m88.com怎么样?66smsm.comwww.zpwbj.com 这个网址是真的吗?我想知道它的真实性.......谢谢 我就剩50了,都给你了..............
企业域名备案 dns是什么 awardspace rackspace sugarsync 私人服务器 Hello图床 免费smtp服务器 云全民 中国智能物流骨干网 蜗牛魔方 北京双线机房 速度云 多线空间 789电视剧 卡巴斯基是免费的吗 drupal安装 宏讯 shuang12 中国域名 更多