Server shutdown method and device, storage medium and electronic equipment
By detecting the signal of the power switch button in the server and determining the target function status, sending appropriate signals to prohibit shutdown operations, the forced shutdown problem caused by the error touch of the server power switch button is solved, and the stability and data security of the system are improved .
Patent Information
- Application Number
- CN202411000902.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-12
AI Technical Summary
The server's power-on and shutdown button is easily touched by mistake, resulting in the server being forced to shut down, causing business interruptions and data loss.
By detecting the signal that the power switch button is touched on the server programmable device, and determining whether the server enables the target function. If it is turned on, a signal with a duration less than the preset threshold is sent to the central processor through the programmable controller, which prohibits execution Shut down operation to avoid forced shutdown caused by accidental touch.
It reduces the probability that the server is forced to shut down by mistake, and protects users' business continuity and data security.
Smart Images

Figure CN118939330A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a server shutdown method and device, a storage medium, and an electronic device. Background Art
[0002] The server panel is a graphical user interface for managing and monitoring servers, which can help administrators easily configure, monitor and maintain servers. Its hardware panel is equipped with a power button. In related technologies, when a data center server experiences an abnormality such as a system crash, the server can be forced to shut down by long pressing the power button (for example, long pressing for 3 seconds). Then, by pressing the power button again, the server can be started normally to resume normal service.
[0003] However, large servers require a long system initialization time due to their numerous peripheral resources. Booting requires time to load initialization resources. Furthermore, data centers are cluttered with power cords, network cables, and other cables, which can easily squeeze the power button. Operations and maintenance personnel can also accidentally touch the power button, forcing the server to shut down or even repeatedly power it on and off. An unexpected device shutdown can disrupt business operations and negatively impact users. Furthermore, during an unexpected forced power-off, user data cached in memory is cleared by the system, resulting in data loss and user losses.
[0004] In the related art, there is currently no effective solution to the problem that the server's power button is easily accidentally touched, causing the server to be forced to shut down. Summary of the Invention
[0005] The embodiments of the present application provide a server shutdown method and apparatus, a storage medium, and an electronic device to at least solve the problem that the server's power button is easily accidentally touched, resulting in the server being forced to shut down.
[0006] According to one embodiment of the present application, a server shutdown method is provided, comprising: when a programmable device of the server detects a first signal, determining, by the programmable device, whether a target function is enabled on the server, wherein the first signal is a signal generated when a power button of the server is touched, and when the server has enabled the target function, forcibly shutting down the server by the power button is not allowed; when the programmable device determines that the server has enabled the target function, sending, by the programmable device, a second signal to a central processing unit (CPU) of the server, wherein the duration of the second signal is less than a preset threshold; when the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the powered-on state, prohibiting the CPU from executing the shutdown operation of the server.
[0007] In an exemplary embodiment, after the second signal is sent to the central processing unit CPU through the programmable device, the method further includes: when the CPU obtains the second signal and the server is in a shutdown state, sending a power-on instruction to the programmable device through the CPU; when the programmable device obtains the power-on instruction, sending a power supply instruction to the power supply circuit of the server through the programmable device to instruct the power supply circuit to supply power to the components of the server.
[0008] In an exemplary embodiment, the method further includes: when the programmable device determines that the server has turned off the target function, determining the duration of the first signal through the programmable device, and determining a preset duration based on the duration of the first signal, wherein the duration of the first signal is determined based on the duration for which the power button is touched, and when the server has turned off the target function, allowing the power button to be used to forcibly shut down the server; sending the second signal to the central processing unit CPU through the programmable device for the preset duration; and determining whether the server is turned on or off when the CPU obtains the second signal. machine state; when it is determined that the server is in the shutdown state, sending a power-on instruction to the programmable device through the CPU to instruct the programmable device to send a power supply instruction to the power supply circuit of the server; when it is determined that the server is in the power-on state, determining the duration of the second signal; when the duration of the second signal is less than the preset threshold, prohibiting the CPU from executing the shutdown operation of the server; when the duration of the second signal is greater than or equal to the preset threshold, sending a shutdown power-off instruction to the programmable device through the CPU to instruct the programmable device to send a power-off instruction to the power supply circuit of the server.
[0009] In an exemplary embodiment, determining whether the server has enabled the target function through the programmable device includes: obtaining data stored in a first register in the programmable device; when the data stored in the first register is first data, determining that the server has enabled the target function; when the data stored in the first register is not the first data, determining that the server has disabled the target function.
[0010] In an exemplary embodiment, the method further includes: writing data into the first register through a baseboard management controller BMC to configure the target function of the server; when the data written into the first register through the BMC is not the first data, configuring the target duration through the BMC, wherein the target duration is the duration for the server to shut down the target function; when the time interval between the current moment and the preset moment is greater than the target duration, writing the first data into the first register through the BMC, wherein the preset moment is the moment when the BMC configures the target duration.
[0011] In an exemplary embodiment, the method further includes: when the server is in a powered-on state, obtaining, through the programmable device, data stored in a second register in the programmable device, wherein the data stored in the second register is data written by the BMC when the server is in a powered-on state; when the data stored in the second register is second data, sending a power-off instruction to the power supply circuit of the server through the programmable device to instruct the power supply circuit to prohibit supplying power to the components of the server.
[0012] In an exemplary embodiment, the method further includes: displaying a prompt message when the BMC is about to write data into the second register, wherein the prompt message is used to prompt for input of a verification code; and writing data to the second register through the BMC when a verification code is obtained and the verification code is a preset verification code.
[0013] According to another embodiment of the embodiments of the present application, a server shutdown device is also provided, including: a first determination module, for determining whether the server has turned on a target function through a programmable device of the server when the programmable device detects a first signal, wherein the first signal is a signal generated when the power button of the server is touched, and when the server has turned on the target function, the server is not allowed to be forcibly shut down through the power button; a sending module, for sending a second signal to a central processing unit (CPU) of the server through the programmable device when the programmable device determines that the server has turned on the target function, wherein the duration of the second signal is less than a preset threshold; a prohibition module, for prohibiting the CPU from executing the shutdown operation of the server when the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0015] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] According to another embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0017] Through this application, when a programmable device of a server detects a first signal generated by the power button being touched, the programmable device determines whether the server has enabled the target function. If so, a second signal is sent to the central processing unit via the programmable controller, wherein the duration of the second signal is less than a preset threshold, so that the CPU does not execute the server shutdown operation. This can prevent the CPU from executing the server shutdown operation after the power button is long pressed. This solves the problem of the server's power button being easily accidentally touched, causing the server to be forced to shut down, and reduces the probability of the server being accidentally forced to shut down. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 This is a hardware structure block diagram of a server device according to a server shutdown method according to an embodiment of the present application;
[0020] Figure 2 This is a schematic diagram of an optional system architecture for implementing the present application according to an embodiment of the present application;
[0021] Figure 3 is a flow chart of a server shutdown method according to an embodiment of the present application;
[0022] Figure 4 This is a flowchart of an optional system implementing the present application according to an embodiment of the present application;
[0023] Figure 5 This is a schematic diagram of signal transmission when an optional forced shutdown mask register is closed according to an embodiment of the present application;
[0024] Figure 6 This is a schematic diagram of signal transmission when an optional forced shutdown mask register is turned on according to an embodiment of the present application;
[0025] Figure 7 This is a schematic diagram of an optional forced shutdown process according to an embodiment of the present application;
[0026] Figure 8 This is a structural block diagram of a server shutdown device according to an embodiment of the present application;
[0027] Figure 9 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0030] The server shutdown method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure diagram of a server device in a server shutdown method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown) processor 102 (processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 for communication functions and an input and output device 108. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0031] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the server shutdown method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by a communication provider of a server device. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] In order to better understand this application, the server shutdown component architecture is described below. Figure 2 As shown:
[0034] The entire server system consists of a power button, a complex programmable logic controller (CPLD), a field programmable gate array (FPGA), a central processing unit (CPU), a baseboard management controller (BMC), and a power supply circuit.
[0035] like Figure 2 In the figure, 1 is the input signal from the on / off button (the first signal below), 2 is the key signal output by the CPLD / FPGA to the CPU. A sustained low level of 3 seconds or longer indicates a forced shutdown, while a sustained low level of less than 3 seconds indicates a power-on. 3 is the power-on and power-off control signal output by the CPU to the CPLD / FPGA. A low level powers down the system, while a high level powers it back on. When the on / off button is pressed, the input signal changes from a high level to a low level. Releasing the button returns the input signal from a low level to a high level. The system executes the power-on and power-off commands based on how long the low level persists. Generally, a long press of 3 seconds or longer indicates a forced shutdown.
[0036] In order to solve the above problems existing in the related art, this embodiment provides a server shutdown method, which is applied to the above server, such as Figure 3 As shown, the process includes the following steps S302-S306:
[0037] Step S302: When a programmable device of the server detects a first signal, determining, by the programmable device, whether a target function of the server is enabled, wherein the first signal is a signal generated when a power button of the server is touched, and when the target function is enabled on the server, forcible shutdown of the server by using the power button is not allowed;
[0038] It should be noted that the target function is to block the forced shutdown function. When the server has the forced shutdown function blocked, the server cannot be forced to shut down by long pressing the power button.
[0039] It should be noted that the programmable device is a CPLD or an FPGA.
[0040] Optionally, the first signal is a low-level signal. When the power button is not pressed, the programmable device continuously obtains a high-level signal corresponding to the power button. When the power button is pressed, the programmable device obtains a low-level signal corresponding to the power button. The programmable device can determine the length of time the power button is touched based on the duration of the first signal.
[0041] In an exemplary embodiment, determining whether a server has enabled a target function by a programmable device may be implemented by following steps S11 to S13:
[0042] Step S11: Acquire data stored in a first register in the programmable device, wherein the data stored in the first register is data written by the BMC;
[0043] Step S12: When the data stored in the first register is the first data, determining that the server has enabled the target function;
[0044] Step S13: If the data stored in the first register is not the first data, it is determined that the server has disabled the target function.
[0045] Optionally, the first register is a shielded forced shutdown register. When the data in the first register is 0x01 (i.e., the first data mentioned above), it is determined that the server has turned on the target function. In this case, the power button on the server is shielded, so that the function of long pressing the power button to force the server to shut down is invalid, that is, the server cannot be shut down through the power button, thereby avoiding the situation where the server is forced to shut down due to accidental touching of the power button; when the data in the first register is 0x00, it is determined that the server has turned off the target function.
[0046] It should be noted that through the above steps, the editable device can quickly and accurately determine whether the target function is enabled on the server, and realize the control of the server's power on and off functions, thereby meeting the needs of different usage scenarios. At the same time, it avoids the situation where the server is forced to shut down in the event of an equipment abnormality, ensuring that the user's business is not abnormally interrupted and protecting the user's data security.
[0047] In an exemplary embodiment, the method further includes the following steps S21-S23:
[0048] Step S21: writing data into the first register through a baseboard management controller (BMC) to configure the target function of the server;
[0049] Optionally, when the data written by the BMC to the first register is 0x0 1, the configuration server enables the target function. When the data written by the BMC to the first register is 0x0 1, the configuration server enables the target function.
[0050] Optionally, when the server system is initialized, the BMC may set the data stored in the first register to 0x01, so that the server enables the target function.
[0051] Optionally, the BMC may write data into the first register via I2C.
[0052] Step S22: If the data written to the first register by the BMC is not the first data, configuring a target duration by the BMC, wherein the target duration is a duration for the server to disable the target function;
[0053] Optionally, in this embodiment, the physical forced shutdown function of the server is only allowed to be implemented for a short period of time. Therefore, when the data written to the first register through the BMC is not the first data, a prompt message needs to be displayed to prompt the configuration of the target duration and the risk of shutting down the target function.
[0054] Optionally, after the target duration is configured, the BMC will actively start a timer to count.
[0055] Step S23: when the time interval between the current moment and the preset moment is greater than the target duration, writing the first data into the first register via the BMC, wherein the preset moment is the moment when the BMC configures the target duration.
[0056] Optionally, if the data written by the BMC to the first register is not the first data (for example, 0x00), and the target duration configured by the BMC is 12 hours, then within the 12 hours, forced shutdown is allowed through the power button of the server. After 12 hours, the BMC will actively write the first data to the first register to actively turn on the target function of the server, so that the server does not allow forced shutdown through the power button.
[0057] In this embodiment, the server target function is configured through the BMC, thereby improving the configuration efficiency of the server target function by the administrator. In addition, after briefly turning off the server target function, the server target function is turned on at a regular interval to prevent the administrator from forgetting to turn on the server target function, thereby ensuring the safe operation of the server.
[0058] Step S304: When the programmable device determines that the server has enabled the target function, the programmable device sends a second signal to the central processing unit (CPU) of the server, wherein the duration of the second signal is less than a preset threshold.
[0059] It should be noted that, in this embodiment, no matter how long the duration of the first signal detected by the programmable device is, the programmable device sends a second signal with a duration less than a preset threshold to the CPU.
[0060] Optionally, the second signal is a low-level signal.
[0061] Step S306: When the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state, prohibit the CPU from executing the shutdown operation of the server.
[0062] It should be noted that when the server is in the power-on state, if the CPU obtains that the duration of continuous acquisition of the second signal is less than the preset threshold, the CPU does not perform any operation. If the CPU obtains that the duration of continuous acquisition of the second signal is greater than or equal to the preset threshold, the CPU executes the server shutdown operation.
[0063] In the above steps, when the programmable device of the server detects the first signal generated by the power button being touched, the programmable device determines whether the server has enabled the target function. If so, the programmable controller sends a second signal to the central processing unit, wherein the duration of the second signal is less than a preset threshold, so that the CPU does not execute the server shutdown operation. This can prevent the CPU from executing the server shutdown operation after the power button is long pressed. This solves the problem of the server's power button being easily accidentally touched, resulting in the server being forced to shut down, and reduces the probability of the server being accidentally forced to shut down.
[0064] It should be noted that the server has a storage power supply, which can power the CPU when the server is in the off state (the storage power supply can only power the CPU when the server is connected to a power supply), so that the CPU can execute the server startup operation according to the signal sent by the programmable device.
[0065] In an exemplary embodiment, after the above step S204, the method further includes the following steps S31-S32:
[0066] Step S31: When the CPU obtains the second signal and the server is in a shutdown state, the CPU sends a power-on instruction to the programmable device;
[0067] It should be noted that, when the server is in a shutdown state, if the CPU obtains the second signal, the server executes a server power-on operation and sends a power-on instruction to the programmable device.
[0068] Step S32: When the programmable device obtains the power-on instruction, the programmable device sends a power supply instruction to the power supply circuit of the server to instruct the power supply circuit to supply power to the components of the server.
[0069] It should be noted that the components of the server include devices in the server that require electricity, including the CPU.
[0070] It should be noted that, in this embodiment, when the target function is enabled on the server, the server can also be powered on by pressing the power button.
[0071] In an exemplary embodiment, the method further includes the following steps S41-S46:
[0072] Step S41: When the programmable device determines that the server has disabled the target function, the programmable device determines a duration of the first signal, and determines a preset duration based on the duration of the first signal, wherein the duration of the first signal is determined based on the duration for which the power button is touched. When the server has disabled the target function, the power button is allowed to forcibly shut down the server.
[0073] Optionally, the duration of the first signal is equal to the duration of the power button being touched, and the preset duration is equal to the duration of the first signal.
[0074] Step S42: sending the second signal to the central processing unit CPU via the programmable device for the preset time period;
[0075] Optionally, in order to prevent the first signal from being erroneously generated, the editable device filters the first signal before sending the second signal to the CPU, and the filtering time is 20 milliseconds.
[0076] Step S43: When the CPU obtains the second signal, determining the power on / off state of the server;
[0077] Step S44: When it is determined that the server is in a shutdown state, the CPU sends a power-on instruction to the programmable device to instruct the programmable device to send a power supply instruction to the power supply circuit of the server;
[0078] Step S45: When it is determined that the server is in the power-on state, determining the duration of the second signal;
[0079] Step S46: When the duration of the second signal is less than the preset threshold, the CPU is prohibited from executing the shutdown operation of the server; when the duration of the second signal is greater than or equal to the preset threshold, a shutdown and power-off instruction is sent to the programmable device through the CPU to instruct the programmable device to send a power-off instruction to the power supply circuit of the server.
[0080] It should be noted that through the above steps, even if the target function of the server is turned off, the server can be turned on and forced to shut down normally through the server's power button, so that the server can be flexibly applied to different usage scenarios, with greater versatility to meet the different needs of users.
[0081] In an exemplary embodiment, the method further includes the following steps S51-S52:
[0082] Step S51: When the server is in the power-on state, obtain, through the programmable device, data stored in a second register in the programmable device, wherein the data stored in the second register is data written by the BMC when the server is in the power-on state;
[0083] Step S52: When the data stored in the second register is the second data, a power-off instruction is sent to the power supply circuit of the server through the programmable device to instruct the power supply circuit to prohibit supplying power to the components of the server.
[0084] Optionally, the second register is a forced shutdown register, and its initial default value is 0. After powering on, the shutdown process is as follows: Figure 7 According to user needs, the BMC writes data to the forced shutdown register. When the programmable device reads that the forced shutdown register is 1, the programmable device controls the power supply circuit to cut off the power, so that the server is shut down. The server can be forced to shut down without pressing the power button, thereby preventing users from being unable to recover when the system crashes and avoiding the loss of central data. When the programmable device reads that the forced shutdown register is not 1, the server continues to work normally.
[0085] In an exemplary embodiment, the method further includes the following steps S61-S62:
[0086] Step S61: When the BMC is about to write data into the second register, display a prompt message, wherein the prompt message is used to prompt the user to enter a verification code;
[0087] Step S62: When a verification code is obtained and the verification code is a preset verification code, data is written into the second register through the BMC.
[0088] That is, when a user or administrator uses the BMC operating software to force a server shutdown, the BMC requires a verification code or displays a data loss risk warning. It is recommended to use a forced shutdown when the server is down.
[0089] In an exemplary embodiment, the method further includes: sending a shutdown instruction to the programmable device through the BMC, wherein the programmable instruction is used to instruct the programmable device to control the power supply circuit to cut off power, so that the server is shut down.
[0090] In an exemplary embodiment, the method further includes: sending a shutdown instruction to the network communication module through a network communication connection established with the network communication module in the server, so that the network communication module forwards the shutdown instruction to the programmable device, wherein the network communication module includes a UART communication module.
[0091] In this embodiment, through the above method, the programmable device can more efficiently execute the server shutdown operation.
[0092] It should be noted that, through the above steps S61-S62, when the user executes a forced shutdown through the BMC, further information verification can be performed to confirm the execution of the forced shutdown operation, thereby avoiding data loss caused by user misoperation.
[0093] Obviously, the embodiments described above are only part of the embodiments of the present invention, rather than all of the embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but it is not intended to limit the technical solutions of the embodiments of the present invention. Specifically, a programmable device is a CPLD as an example:
[0094] In this application, BMC and CPLD are used in conjunction. When the CPLD is initialized, the forced shutdown signal is blocked from reaching the CPU by default through the forced shutdown shield register (i.e., the first register mentioned above), and the device cannot be forced to shut down through the physical button. If the user needs to force shutdown by the physical button, the BMC configuration can be used to turn off the server's forced shutdown function of shielding the physical button, such as 8 hours, 24 hours, etc., so that the physical forced shutdown function can be realized in the short term. After the set time is reached, the BMC will actively reconfigure the server's forced shutdown function of shielding the physical button, turn off the forced shutdown function of the physical button, and protect the device from abnormal shutdown.
[0095] Optionally, the process of the embodiment of the present application refers to Figure 4 ,include:
[0096] 1. During system initialization, the BMC sets the forced shutdown shield register to 0x0 1, which means that the forced shutdown function of the physical button is blocked. If you want to enable the forced shutdown function of the physical button, you need to set the forced shutdown shield register to 0x00;
[0097] 2. When the physical button of the switch is pressed, the programmable logic device detects whether the forced shutdown shield register is set to 0x0 1. If it is 0x0 1, the programmable logic device filters for 20ms, briefly outputs a low level (lower than the forced shutdown time), and continuously outputs a high level to the CPU. When the CPU detects a short key press, it first determines whether the power is on. If it is in the shutdown state, it outputs a power-on command to the programmable logic device. If it is already in the power-on state, it continues to operate normally. In this way, the forced shutdown function of the physical button can be shielded, and only the power-on function of the switch button is retained, thereby avoiding service interruption or even data loss caused by abnormal power-off of the data center server;
[0098] 3. If the forced shutdown mask register is 0x00, the programmable logic device will filter for 20ms and then continuously output the corresponding level to the CPU according to the key status. The CPU will detect the key signal and first determine whether it is already in the power-on state. If it is in the power-off state, it will output the power-on command to the programmable logic device. If it is already in the power-on state, it will detect whether the duration is greater than or equal to 3S. If it is less than 3S, it will continue to operate normally. If it is greater than or equal to 3S, the CPU will send a power-off signal to the programmable logic device, and the programmable logic device will control the peripheral circuit to power off and force shutdown. In this way, the forced shutdown function of the physical button can be realized;
[0099] 4. When a user or administrator enables the physical button forced shutdown function through BMC configuration, the BMC interface issues an alert warning of potential risks. The interface provides a time window for enabling the physical button forced shutdown function: 12 hours, 24 hours, or 48 hours. If the user selects 24 hours, a timer starts. When the timer expires, the forced shutdown mask register is set to 0x01, disabling the physical button forced shutdown function. This protects customer data security and ensures normal business operations.
[0100] When forced shutdown is allowed, the key signal is transmitted as follows Figure 5 As shown, the key is filtered by the programmable logic controller for 20ms and then transmitted as a real key for 3S. The CPU can normally receive the long key signal. Figure 5 Among them, 1 is the signal transmitted from the button to the CPLD, and 2 is the signal transmitted from the CPLD to the CPU.
[0101] When forced shutdown is not allowed, the key signal is transmitted as follows Figure 6 As shown in the figure, the key is filtered by the programmable logic controller for 20ms, and only the signal within 1S is transmitted, shielding the ultra-long key signal from reaching the CPU, thus realizing the shielding of the physical key forced shutdown. Figure 6 Among them, 1 is the signal transmitted from the button to the CPLD, and 2 is the signal transmitted from the CPLD to the CPU.
[0102] It should be noted that the application scenarios of this application include but are not limited to servers, storage servers, storage arrays, switches and other data center equipment.
[0103] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0104] This embodiment also provides a server shutdown device for implementing the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. While the modules described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0105] Figure 8 : is a structural block diagram of a server shutdown device according to an embodiment of the present application, the device comprising:
[0106] A first determining module 802 is configured to determine, when a programmable device of the server detects a first signal, whether the server has enabled a target function, using the programmable device, wherein the first signal is a signal generated when a power button of the server is touched, and when the server has enabled the target function, forcible shutdown of the server using the power button is not allowed;
[0107] a sending module 804, configured to send a second signal to a central processing unit (CPU) of the server through the programmable device when the programmable device determines that the server has enabled the target function, wherein the duration of the second signal is less than a preset threshold;
[0108] The prohibition module 806 is configured to prohibit the CPU from executing a shutdown operation on the server when the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state.
[0109] In the above-mentioned device, when the programmable device of the server detects a first signal generated by the power button being touched, the programmable device determines whether the server has enabled the target function. If so, the programmable controller sends a second signal to the central processing unit. The duration of the second signal is less than a preset threshold, so that the CPU does not execute the server shutdown operation. This can prevent the CPU from executing the server shutdown operation after the power button is long pressed. This solves the problem of the server's power button being easily accidentally touched, resulting in the server being forced to shut down, and reduces the probability of the server being accidentally forced to shut down.
[0110] In an exemplary embodiment, the device also includes: a processing module, which is used to send a power-on instruction to the programmable device through the CPU after the second signal is sent to the central processing unit CPU through the programmable device, when the CPU obtains the second signal and the server is in a shutdown state; and when the programmable device obtains the power-on instruction, send a power supply instruction to the power supply circuit of the server through the programmable device to instruct the power supply circuit to power the components of the server.
[0111] In an exemplary embodiment, the above-mentioned device also includes: a second determination module, which is used to determine the duration of the first signal through the programmable device when the programmable device determines that the server has turned off the target function, and determine a preset duration based on the duration of the first signal, wherein the duration of the first signal is determined based on the duration for which the power button is touched, and when the server turns off the target function, the power button is allowed to forcibly shut down the server; the sending module 804 is also used to send the second signal to the central processing unit CPU through the programmable device for the preset duration; the processing module is also used to process the CPU obtaining the second signal When it is determined that the server is in the shutdown state, a power-on instruction is sent to the programmable device through the CPU to instruct the programmable device to send a power supply instruction to the power supply circuit of the server; when it is determined that the server is in the power-on state, the duration of the second signal is determined; when the duration of the second signal is less than the preset threshold, the CPU is prohibited from executing the shutdown operation of the server; when the duration of the second signal is greater than or equal to the preset threshold, a power-off instruction is sent to the programmable device through the CPU to instruct the programmable device to send a power-off instruction to the power supply circuit of the server.
[0112] In an exemplary embodiment, the first determination module 802 is also used to obtain data stored in a first register in the programmable device; when the data stored in the first register is the first data, it is determined that the server has turned on the target function; when the data stored in the first register is not the first data, it is determined that the server has turned off the target function.
[0113] In an exemplary embodiment, the above-mentioned device also includes: a configuration module, which is used to write data into the first register through the baseboard management controller BMC to configure the target function of the server; when the data written into the first register through the BMC is not the first data, configuring the target duration through the BMC, wherein the target duration is the duration for the server to shut down the target function; when the time interval between the current moment and the preset moment is greater than the target duration, writing the first data into the first register through the BMC, wherein the preset moment is the moment when the BMC configures the target duration.
[0114] In an exemplary embodiment, the acquisition module is further used to obtain, through the programmable device, data stored in a second register in the programmable device when the server is in a powered-on state, wherein the data stored in the second register is data written by the BMC when the server is in a powered-on state; the sending module 804 is further used to send a power-off instruction to the power supply circuit of the server through the programmable device when the data stored in the second register is second data, to instruct the power supply circuit to prohibit powering the components of the server.
[0115] In an exemplary embodiment, the above-mentioned configuration module is also used to display a prompt message when the BMC is about to write data into the second register, wherein the prompt message is used to prompt the input of a verification code; when the verification code is obtained and the verification code is a preset verification code, the data is written to the second register through the BMC.
[0116] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0117] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when run.
[0118] Optionally, in this embodiment, the computer program may be configured to perform the following steps:
[0119] S1. When a programmable device of a server detects a first signal, determining, by the programmable device, whether a target function of the server is enabled, wherein the first signal is a signal generated when a power button of the server is touched, and when the target function is enabled on the server, forcible shutdown of the server by using the power button is not allowed;
[0120] S2, when the programmable device determines that the server has enabled the target function, sending a second signal to the central processing unit (CPU) of the server through the programmable device, wherein the duration of the second signal is less than a preset threshold;
[0121] S3: When the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state, prohibit the CPU from executing the shutdown operation of the server.
[0122] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0123] The embodiment of the present application also provides an electronic device, such as Figure 9 As shown, the electronic device includes a memory 908 and a processor 904. The memory 908 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0124] Optionally, in this embodiment, the processor 904 may be configured to execute the following steps through a computer program:
[0125] S1. When a programmable device of a server detects a first signal, determining, by the programmable device, whether a target function of the server is enabled, wherein the first signal is a signal generated when a power button of the server is touched, and when the target function is enabled on the server, forcible shutdown of the server by using the power button is not allowed;
[0126] S2, when the programmable device determines that the server has enabled the target function, sending a second signal to the central processing unit (CPU) of the server through the programmable device, wherein the duration of the second signal is less than a preset threshold;
[0127] S3: When the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state, prohibit the CPU from executing the shutdown operation of the server.
[0128] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0129] Alternatively, those skilled in the art will appreciate that Figure 9 The structure shown is for illustration only. Figure 9 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 9 Different configurations shown.
[0130] Among them, the memory 908 can be used to store software programs and modules, such as the program instructions / modules corresponding to the server shutdown method and the server shutdown device in the embodiment of the present application. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 908, that is, realizing the above-mentioned server shutdown method. The memory 908 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 908 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 908 can be used specifically but not limited to store information such as system configuration files. As an example, such as Figure 9 As shown, the memory 908 may include, but is not limited to, the first determining module 802, the sending module 804, and the prohibiting module 806 in the server shutdown device. In addition, it may also include, but is not limited to, other module units in the server shutdown device, which will not be repeated in this example.
[0131] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one embodiment, the transmission device 906 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0132] In addition, the electronic device further includes: a display 908; and a connection bus 910 for connecting various module components in the electronic device.
[0133] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0134] An embodiment of the present application further provides another computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above method embodiments are implemented.
[0135] An embodiment of the present application also provides a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above method embodiments.
[0136] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0137] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A server shutdown method, characterized in that: include: When a programmable device of the server detects a first signal, determining whether the server has enabled a target function through the programmable device, wherein the first signal is a signal generated when a power button of the server is touched, and when the server has enabled the target function, forcibly shutting down the server through the power button is not allowed; When the programmable device determines that the server has turned on the target function, a second signal is sent to the central processing unit CPU of the server through the programmable device, wherein the duration of the second signal is less than a preset threshold; when the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in the power-on state, the CPU is prohibited from executing the shutdown operation of the server.
2. The method according to claim 1, characterized in that After sending the second signal to the central processing unit CPU through the programmable device, the method further includes: When the CPU obtains the second signal and the server is in a shutdown state, sending a power-on instruction to the programmable device through the CPU; When the programmable device obtains the power-on instruction, the programmable device sends a power supply instruction to the power supply circuit of the server to instruct the power supply circuit to supply power to the components of the server.
3. The method according to claim 1, characterized in that: The method further comprises: In the case where the programmable device determines that the server has turned off the target function, the duration of the first signal is determined by the programmable device, and a preset duration is determined according to the duration of the first signal, wherein the duration of the first signal is determined according to the duration for which the power button is touched, and in the case where the server has turned off the target function, the power button is allowed to forcibly shut down the server; Sending the second signal to the central processing unit CPU by the programmable device for the preset time period; When the CPU obtains the second signal, determining the power on / off state of the server; When it is determined that the server is in a shutdown state, sending a power-on instruction to the programmable device through the CPU to instruct the programmable device to send a power supply instruction to a power supply circuit of the server; In the case where it is determined that the server is in a powered-on state, determining a duration of the second signal; When the duration of the second signal is less than the preset threshold, the CPU is prohibited from executing the shutdown operation of the server; when the duration of the second signal is greater than or equal to the preset threshold, the CPU sends a shutdown command to the programmable device to instruct the programmable device to send a power-off command to the power supply circuit of the server.
4. The method according to claim 1, characterized in that: The determining, by the programmable device, whether the server enables the target function comprises: Acquire data stored in a first register in the programmable device; When the data stored in the first register is the first data, determining that the server has enabled the target function; When the data stored in the first register is not the first data, it is determined that the server has disabled the target function.
5. The method according to claim 4, characterized in that The method further comprises: Writing data into the first register through a baseboard management controller BMC to configure the target function of the server; In a case where the data written to the first register through the BMC is not the first data, configuring a target duration through the BMC, wherein the target duration is a duration for the server to shut down the target function; When the time interval between the current time and the preset time is greater than the target duration, the first data is written into the first register through the BMC, wherein the preset time is the time when the BMC configures the target duration.
6. The method according to claim 1, characterized in that The method further comprises: When the server is in a powered-on state, acquiring, through the programmable device, data stored in a second register in the programmable device, wherein the data stored in the second register is data written by the BMC when the server is in a powered-on state; In a case where the data stored in the second register is the second data, a power-off instruction is sent to the power supply circuit of the server through the programmable device to instruct the power supply circuit to prohibit supplying power to the components of the server.
7. The method according to claim 6, characterized in that The method further comprises: When the BMC is about to write data into the second register, displaying prompt information, wherein the prompt information is used to prompt input of a verification code; When a verification code is obtained and the verification code is a preset verification code, data is written into the second register through the BMC.
8. A server shutdown device, characterized in that: include: A first determination module is used to determine whether the server has enabled a target function through the programmable device when the programmable device of the server detects a first signal, wherein the first signal is a signal generated when a power button of the server is touched, and when the server has enabled the target function, it is not allowed to forcibly shut down the server through the power button; a sending module, configured to send a second signal to a central processing unit (CPU) of the server through the programmable device when the programmable device determines that the server has enabled the target function, wherein the duration of the second signal is less than a preset threshold; A prohibition module is used to prohibit the CPU from executing a shutdown operation of the server when the CPU obtains the second signal, the duration of the second signal is less than the preset threshold, and the server is in a powered-on state.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Startup and shutdown exception handling method for service user terminal equipment
CN120045394A
Power supply control method and device, startup and shutdown management system, server and medium
CN120560485A
