CN110609765B - Method, system, equipment and storage medium for automatically and randomly restarting server - Google Patents

Method, system, equipment and storage medium for automatically and randomly restarting server Download PDF

Info

Publication number
CN110609765B
CN110609765B CN201910760224.5A CN201910760224A CN110609765B CN 110609765 B CN110609765 B CN 110609765B CN 201910760224 A CN201910760224 A CN 201910760224A CN 110609765 B CN110609765 B CN 110609765B
Authority
CN
China
Prior art keywords
server
module
restarting
restart
automatic shutdown
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910760224.5A
Other languages
Chinese (zh)
Other versions
CN110609765A (en
Inventor
范鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201910760224.5A priority Critical patent/CN110609765B/en
Publication of CN110609765A publication Critical patent/CN110609765A/en
Application granted granted Critical
Publication of CN110609765B publication Critical patent/CN110609765B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2284Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing by power-on test, e.g. power-on self test [POST]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Power Sources (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method, a system, equipment and a storage medium for automatically randomly restarting a server, which comprises the following steps: s1-1: receiving a server starting instruction to execute server power-on; s1-2: the out-of-band control is carried out through the IP of a BMC port by using an ipmitool tool, so that the automatic shutdown and restart in the starting process of the server are realized; s1-3: creating a random number generating function to generate a random number X; s1-4: and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds. The random restart of the server can be realized in the process from the power-on startup of the server to the time before the server enters the OS. Therefore, the reliability and stability of the server in the starting process can be effectively verified.

Description

Method, system, equipment and storage medium for automatically and randomly restarting server
Technical Field
The invention relates to the technical field of server stability testing, in particular to a method, a system, equipment, a product and a storage medium for automatically and randomly restarting a server.
Background
Server restart type testing is an important aspect of verifying server stability. Generally, after a server switch is pressed to start a host, the server operates, specifically, a main board BIOS grasps a plurality of important tasks such as system start, compatibility between components, program management, and the like. Once the Power switch is pressed to start the host, the BIOS starts to take over all Self-checking operations of the motherboard start, and the system first checks each internal device by a POST (Power On Self Test) (this process is also described below). Generally, a complete POST self-test will include testing a CPU, a memory, a hard disk, a network card, and the like. The second phase is then entered and the BIOS reads the operating system boot record in the boot sequence stored in the system CMOS settings. And then starting the boot work of the operating system according to the boot record. And eventually transition completely to the operating state of the operating system. Any small step error in the middle may cause the system to fail to boot and crash.
At present, the restart stability test of a computer server is mainly performed by executing a restart instruction under a system after entering a working state of an operating system. The method is that under the OS operating system, the OS sends out a restart instruction, and then the restart action of the OS and the server hardware is realized. However, only the stability of the server restart during the OS operation can be verified, and the stability of the server during the system start (before the OS is entered) cannot be effectively determined. In the actual use process, a user may perform manual forced shutdown on the server in the server starting process, so that the operation may damage the server and influence the subsequent normal use of the server computer, and an effective test method is not available at present.
Disclosure of Invention
The invention provides a method, a system, equipment and a storage medium for automatically and randomly restarting a server, aiming at the problems that in the actual use process, a user possibly carries out manual forced shutdown on the server in the starting process of the server, the operation is damaged, and the subsequent normal use of a server computer can not be influenced.
The technical scheme of the invention is as follows:
in a first aspect, a technical solution of the present invention provides a method for automatically restarting a server at random, including the following steps:
receiving a server starting instruction to execute server power-on;
performing out-of-band control through an IP of a BMC port to realize automatic shutdown and restart in the starting process of the server;
creating a random number generating function to generate a random number X;
and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds.
Preferably, in the step of setting the random number generating function to generate a random number X, X is an integer greater than 0 and smaller than Y; and the server needs Y seconds to enter an operating system interface after being started.
Preferably, the method further comprises:
monitoring the starting process of the server; if the monitoring is normal, the next step is carried out, and if the server is abnormally started, the execution of the server restart is stopped, and an alarm is given;
and clearing the system log and restarting the server.
Preferably, the method further comprises:
acquiring state information of a server;
when the server is determined to need to be restarted according to the acquired state information of the server, sending a restarting message to the server, so that the server is restarted according to the restarting message;
And carrying out-of-band control through an IP (Internet protocol) of a BMC (baseboard management controller) port by using an ipmitool tool, so as to realize automatic shutdown and restart in the starting process of the server.
In a second aspect, a technical solution of the present invention provides a system for automatically and randomly restarting a server, including a server startup module, an automatic shutdown restart module: the device comprises a random number generation module and a setting module;
the server starting module is used for receiving a server starting instruction to execute server power-on;
the automatic shutdown and restart module is used for carrying out-of-band control through the IP of the BMC port and realizing automatic shutdown and restart in the starting process of the server;
the random number generating module is used for creating a random number generating function to generate a random number X; x is an integer greater than 0 and less than Y; the server needs Y seconds to enter an operating system interface after being started;
and the setting module is used for setting the automatic restarting again after the server is powered on for X seconds in the automatic shutdown and restarting process of the server.
Preferably, the system further comprises a monitoring module and a processing module;
the monitoring module is used for monitoring the starting process of the server;
the processing module is used for clearing system logs if the monitoring is normal, and the automatic shutdown and restart module executes automatic restart of the server;
And the monitoring module is also used for stopping executing the server restart and giving an alarm if the server is abnormally started.
Preferably, the system further comprises:
the server state acquisition module is used for acquiring the state information of the server;
and the judging module is used for sending a restarting message to the automatic shutdown restarting module when the server is determined to need restarting according to the acquired state information of the server, and the automatic shutdown restarting module restarts according to the restarting message.
In a third aspect, the present invention provides a computer device, including a memory and a processor, where the processor and the memory complete communication with each other through a bus; the memory stores program instructions executable by the processor, the processor being capable of performing the method of the first aspect when invoked by the program instructions.
In a fourth aspect, the present invention provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of the first aspect.
According to the technical scheme, the invention has the following advantages: a method and a system for automatically restarting a server at random after the server is powered on can realize the random restart of the server in the process from the power-on and the power-on of the server to the time before the server enters an OS. Therefore, the reliability and stability of the server in the starting process can be effectively verified.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Therefore, compared with the prior art, the invention has prominent substantive features and remarkable progress, and the beneficial effects of the implementation are also obvious.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method according to a first embodiment of the present invention.
FIG. 2 is a schematic flow chart of a method of a second embodiment of the present invention.
Fig. 3 is a schematic connection diagram of a system according to a third embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
As shown in fig. 1, the technical solution of the present invention provides a method for automatically restarting a server at random, including the following steps:
s1-1: receiving a server starting instruction to execute server power-on;
s1-2: the out-of-band control is carried out through the IP of a BMC port by using an ipmitool tool, so that the automatic shutdown and restart in the starting process of the server are realized;
the specific instructions are as follows, where XXXX denotes the IP address of the BMC port.
ipmitool-I lanplus-H XXXX-U admin-P admin power cycle;
S1-3: creating a random number generating function to generate a random number X;
the random number generation function is set by time (date). And the date is the next instruction of linux, and the input date can display the current time, which can be specific to seconds. The following script is a function rand that implements random number generation using date.
Figure BDA0002170044360000061
Then, a random number between two numbers can be generated using the rand function. Such as rnd $ (rand 0120), any integer between 0 and 120 may be automatically generated. The two numbers 0 and 120 can be set according to actual requirements.
S1-4: and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds.
In this embodiment, after the server is powered on, 180 seconds are required to enter the operating system interface, and rnd $ (rand 0180) can be set, so that any integer between 0 and 180 can be automatically obtained. Assuming that the obtained integer is X, using a sleep command (e.g. sleep X, stopping for X seconds), the server will automatically restart again after powering on for X seconds. X is any integer between 0 and 180.
The problems of automatic shutdown and restarting of the server in the starting process and the randomness of restarting are solved through the steps, so that the server can be restarted randomly in the power-on and starting process. Then, n random automatic restarts can be realized by using the for loop.
The concrete implementation is as follows:
Figure BDA0002170044360000071
Figure BDA0002170044360000081
example two
As shown in fig. 2, the technical solution of the present invention provides a method for automatically restarting a server at random, including the following steps:
s2-1: receiving a server starting instruction to execute server power-on; monitoring the starting process of the server; if the monitoring is normal, the next step is carried out, and if the server is abnormally started, an alarm is given;
s2-2: acquiring state information of a server;
s2-3: when the server is determined to need to be restarted according to the acquired state information of the server, a restarting instruction is sent to the server;
s2-4: and receiving a server restart instruction, clearing the system log, and continuously executing the server restart.
S2-5: performing out-of-band control through an IP of a BMC port to realize automatic shutdown and restart in the starting process of the server; and carrying out-of-band control through an IP (Internet protocol) of a BMC (baseboard management controller) port by using an ipmitool tool, so as to realize automatic shutdown and restart in the starting process of the server.
S2-6: creating a random number generating function to generate a random number X; x is an integer greater than 0 and less than Y; the server needs Y seconds to enter an operating system interface after being started;
s2-7: and in the process of automatically shutting down and restarting the server, automatically restarting the server again after the server is powered on for X seconds.
EXAMPLE III
As shown in fig. 3, the technical solution of the present invention provides a system for automatically performing random reboot on a server, including a server startup module 11, an automatic shutdown reboot module 12, a random number generation module 13, and a setting module 14;
the server starting module 11 is used for receiving a server starting instruction to execute server power-on;
the automatic shutdown and restart module 12 is configured to perform out-of-band control through an IP of the BMC port to implement automatic shutdown and restart in a server startup process;
a random number generation module 13, configured to create a random number generation function to generate a random number X; x is an integer greater than 0 and less than Y; the server needs Y seconds to enter an operating system interface after being started;
and the setting module 14 is used for setting the server to automatically restart again after the server is powered on for X seconds in the automatic shutdown and restart process of the server.
The system also comprises a monitoring module and a processing module;
The monitoring module is used for monitoring the starting process of the server;
the processing module is used for clearing the system logs if the monitoring is normal, and the automatic shutdown and restart module executes the automatic restart of the server;
and the monitoring module is also used for stopping executing the server restart and giving an alarm if the server is abnormally started.
The system further comprises:
the server state acquisition module is used for acquiring the state information of the server;
and the judging module is used for sending a restarting message to the automatic shutdown restarting module when the server is determined to need restarting according to the acquired state information of the server, and the automatic shutdown restarting module restarts according to the restarting message.
Example four
The technical scheme of the invention provides computer equipment which comprises a memory and a processor, wherein the processor and the memory finish mutual communication through a bus; the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method provided by the method embodiments, for example, the method includes: s1-1: receiving a server starting instruction to execute server power-on; s1-2: the out-of-band control is carried out through the IP of a BMC port by using an ipmitool tool, so that the automatic shutdown and restart in the starting process of the server are realized; s1-3: creating a random number generating function to generate a random number X; s1-4: and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds.
EXAMPLE five
The present invention provides a non-transitory computer-readable storage medium, which stores computer instructions, where the computer instructions cause the computer to execute the methods provided by the foregoing method embodiments, for example, the method includes: s1-1: receiving a server starting instruction to execute server power-on; s1-2: the out-of-band control is carried out through the IP of a BMC port by using an ipmitool tool, so that the automatic shutdown and restart in the starting process of the server are realized; s1-3: creating a random number generating function to generate a random number X; s1-4: and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (8)

1. A method for automatically and randomly restarting a server is characterized by comprising the following steps:
receiving a server starting instruction to execute server power-on;
performing out-of-band control through an IP of a BMC port to realize automatic shutdown and restart in the starting process of the server;
creating a random number generating function to generate a random number X; x is an integer greater than 0 and less than Y; the server needs Y seconds to enter an operating system interface after being started;
and in the process of setting the automatic shutdown and restart of the server, the server is automatically restarted after being powered on for X seconds.
2. The method for server automatic random restart according to claim 1, wherein the method further comprises:
Monitoring the starting process of the server; if the monitoring is normal, the next step is carried out, if the server is abnormally started, the execution of the server is stopped, and the server is restarted and an alarm is given;
and clearing the system log and restarting the server.
3. The method for server automatic random restart according to claim 2, wherein the method further comprises:
acquiring state information of a server;
and when the server is determined to need to be restarted according to the acquired state information of the server, sending a restarting message to the server, so that the server is restarted according to the restarting message.
4. The system for automatically randomly restarting the server is characterized by comprising a server starting module and an automatic shutdown restarting module: the device comprises a random number generation module and a setting module;
the server starting module is used for receiving a server starting instruction to execute server power-on;
the automatic shutdown and restart module is used for carrying out-of-band control through the IP of the BMC port and realizing automatic shutdown and restart in the starting process of the server;
the random number generating module is used for creating a random number generating function to generate a random number X; x is an integer greater than 0 and less than Y; the server needs Y seconds to enter an operating system interface after being started;
And the setting module is used for setting the automatic restarting again after the server is powered on for X seconds in the automatic shutdown and restarting process of the server.
5. The system for automatic random restart of server according to claim 4, wherein the system further comprises a monitoring module, a processing module;
the monitoring module is used for monitoring the starting process of the server;
the processing module is used for clearing system logs if the monitoring is normal, and the automatic shutdown and restart module executes automatic restart of the server;
and the monitoring module is also used for stopping executing the server restart and giving an alarm if the server is abnormally started.
6. The system of claim 5, wherein the system further comprises:
the server state acquisition module is used for acquiring the state information of the server;
and the judging module is used for sending a restarting message to the automatic shutdown restarting module when the server is determined to need restarting according to the acquired state information of the server, and the automatic shutdown restarting module restarts according to the restarting message.
7. A computer device, comprising a memory and a processor, wherein the processor and the memory communicate with each other via a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 3.
8. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 1 to 3.
CN201910760224.5A 2019-08-16 2019-08-16 Method, system, equipment and storage medium for automatically and randomly restarting server Active CN110609765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910760224.5A CN110609765B (en) 2019-08-16 2019-08-16 Method, system, equipment and storage medium for automatically and randomly restarting server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910760224.5A CN110609765B (en) 2019-08-16 2019-08-16 Method, system, equipment and storage medium for automatically and randomly restarting server

Publications (2)

Publication Number Publication Date
CN110609765A CN110609765A (en) 2019-12-24
CN110609765B true CN110609765B (en) 2022-08-12

Family

ID=68890432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910760224.5A Active CN110609765B (en) 2019-08-16 2019-08-16 Method, system, equipment and storage medium for automatically and randomly restarting server

Country Status (1)

Country Link
CN (1) CN110609765B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111352662B (en) * 2020-02-16 2022-07-08 苏州浪潮智能科技有限公司 Server starting sequence control method, system, terminal and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130073851A1 (en) * 2011-09-21 2013-03-21 Kabushiki Kaisha Toshiba Control device and computer readable medium
CN109815070A (en) * 2019-01-02 2019-05-28 郑州云海信息技术有限公司 A kind of HOST-BOX server stability test method, apparatus, terminal and storage medium
CN110008070A (en) * 2019-03-11 2019-07-12 苏州浪潮智能科技有限公司 A kind of AEP memory AC test method powered off at random based on power supervisor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130073851A1 (en) * 2011-09-21 2013-03-21 Kabushiki Kaisha Toshiba Control device and computer readable medium
CN109815070A (en) * 2019-01-02 2019-05-28 郑州云海信息技术有限公司 A kind of HOST-BOX server stability test method, apparatus, terminal and storage medium
CN110008070A (en) * 2019-03-11 2019-07-12 苏州浪潮智能科技有限公司 A kind of AEP memory AC test method powered off at random based on power supervisor

Also Published As

Publication number Publication date
CN110609765A (en) 2019-12-24

Similar Documents

Publication Publication Date Title
Fox et al. Self-repairing computers
CN110162435B (en) Method, system, terminal and storage medium for starting and testing PXE of server
CN109241745B (en) Trusted starting method and device of computing platform
CN104424084A (en) System error information detection system and method for server
CN104484592A (en) Method and system for starting factory mode of mobile equipment
CN111414285A (en) Test method, test device and test equipment for starting function of server system
CN113064643B (en) Method, system and medium for instantly-effective modification of BIOS set value
CN104881283A (en) Method and system for obtaining root privilege of terminal device based on android
CN111352779A (en) On-off test method of AC power supply of MOC card and related assembly
CN108737153B (en) Block chain disaster recovery system, method, server and computer-readable storage medium
CN104216776A (en) Quick starting method for Android operating system based on BLCR (Berkeley lab checkpoint restart) technology
CN114116280A (en) Interactive BMC self-recovery method, system, terminal and storage medium
CN110609765B (en) Method, system, equipment and storage medium for automatically and randomly restarting server
CN110187922B (en) Method, device, equipment and storage medium for setting and verifying BIOS (basic input output System) parameters
CN114116276A (en) BMC hang-up self-recovery method, system, terminal and storage medium
CN111352662B (en) Server starting sequence control method, system, terminal and storage medium
CN107870840B (en) IPMI-based server multi-test instruction automatic execution method
CN112000508A (en) Starting repair method of ARM server and related device
CN104750579B (en) The method and apparatus for making memory mirror
CN111488250A (en) High-density multi-node server testing method, system, terminal and storage medium
CN100356350C (en) Device and method for safety operation of state converter for computer equipment
CN104142870A (en) Virtual BIOS (basic input /output system) booting system and virtual BIOS booting method
CN111274075B (en) Method and system for automatically testing random power failure of BOX (BOX) host
CN113742141B (en) Server measuring method and device, computer equipment and storage medium
CN113220358B (en) Multi-platform BIOS information storage method, system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant