Methods, devices, and electronic equipment for executing shell script files
By detecting shell script files in the KVM window and utilizing virtual input devices, the shell script files are automatically uploaded and executed, solving the problem of low efficiency in manual operation in existing technologies and achieving highly efficient automated operation.
Patent Information
- Application Number
- CN202211269189.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-10-17
AI Technical Summary
In existing technologies, administrators need to manually input or upload shell script files to the server, which is inefficient, error-prone, and cannot achieve automated operation.
Automatic uploading and execution are achieved by automatically uploading and executing shell script files using a virtual input device when a shell script file is detected being dragged and dropped into the KVM window. This includes calls to the data interface of the baseboard management controller and the virtual input device.
It enables automatic uploading and execution of shell script files, improving efficiency, avoiding the inefficiency and errors of manual input and uploading, and enhancing the degree of automation of the operation.
Smart Images

Figure CN115562809B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for executing shell script files. Background Technology
[0002] Enterprise servers are typically hosted in dedicated Internet Data Center (IDC) rooms, which are often located in fixed locations, possibly far from the enterprise. Therefore, remote control functionality is crucial for these servers. KVM (Keyboard Video Mouse) devices are used for remote server access. Through a Baseboard Management Controller (BMC), the host system's console is redirected to the administrator's personal computer (PC). Administrators can log into the Baseboard Management Controller's management interface via a browser and enable the KVM function. The host screen will then be displayed in the KVM window, allowing remote control of the server using the administrator's personal computer's keyboard and mouse.
[0003] In practical applications, administrators sometimes need to send shell scripts from their local machines to a server host and execute them via its shell window. Currently, the KVM window of the baseboard management controller interface does not support file transfer. Manually inputting these scripts using the keyboard is inefficient, labor-intensive, and prone to errors. Even if the shell scripts are transferred to the server host via mounting or other methods, manual execution by administrators is still required, which is inefficient. Therefore, a method is needed to automatically upload shell scripts to the server and execute them there. Summary of the Invention
[0004] This invention provides a method, apparatus, and electronic device for executing shell script files, which solves the defects of manually inputting shell script files and uploading them to the server in the prior art, and realizes automatic uploading of shell script files to the server and automatic execution of shell script files on the server.
[0005] This invention provides a method for executing a shell script file, comprising:
[0006] If a shell script file is detected being dragged and dropped into the KVM window of the computer terminal, the dragged shell script file is retrieved and uploaded to the target path of the baseboard management controller.
[0007] If a shell script file to be processed is detected in the target path of the baseboard management controller, a virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to execute the shell script file created in the target path of the server host.
[0008] According to the shell script file execution method provided by the present invention, uploading the dragged shell script file to the target path of the baseboard management controller includes:
[0009] If the file size of the dragged shell script file is less than a preset threshold, the dragged shell script file is uploaded to the target path of the baseboard management controller.
[0010] According to the shell script file execution method provided by the present invention, obtaining the dragged shell script file includes:
[0011] Based on the data interface of the baseboard management controller, the dragged shell script file is obtained from the computer terminal;
[0012] The data interface of the baseboard management controller is an interface implemented based on the Hypertext Transfer Security Protocol or the Simple File Transfer Protocol.
[0013] According to the shell script file execution method provided by the present invention, the step of creating a shell script file identical to the shell script file to be processed in the target path of the server host, and controlling the server host to open a shell window to execute the shell script file created in the target path of the server host, includes:
[0014] Block input from physical input devices and create a shell script file identical to the shell script file to be processed in the target path of the server host;
[0015] After the shell script file identical to the shell script file to be processed is created, the input of the physical input device is restarted.
[0016] According to the shell script file execution method provided by the present invention, the step of creating a shell script file identical to the shell script file to be processed in the target path of the server host includes:
[0017] The shell script file to be processed is validated. If the shell script file to be processed meets the preset rules, a shell script file identical to the shell script file to be processed is created in the target path of the server host.
[0018] The method for executing a shell script file according to the present invention further includes:
[0019] The KVM window displays the execution process and results of the shell script file.
[0020] According to the shell script file execution method provided by the present invention, the shell script file is a single shell script file, multiple shell script files, or a shell script file compressed package.
[0021] The present invention also provides a shell script file execution device, comprising:
[0022] The upload module is used to obtain the dragged shell script file when it is detected that a shell script file has been dragged and dropped into the KVM window of the computer terminal, and upload the dragged shell script file to the target path of the baseboard management controller.
[0023] A creation module is used to, upon detecting the existence of a shell script file to be processed under the target path of the baseboard management controller, invoke a virtual input device to create a shell script file identical to the shell script file to be processed under the target path of the server host, and control the server host to open a shell window to execute the shell script file created under the target path of the server host.
[0024] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the execution method of the shell script file as described above.
[0025] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the execution method of the shell script file as described above.
[0026] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the execution method of any of the shell script files described above.
[0027] The shell script execution method, apparatus, and electronic device provided by this invention create a shell script file identical to the shell script file dragged to the KVM window in the target path of the server host by calling a virtual input device, and control the server host to open a shell window to execute the created shell script file. This process does not require administrators to manually enter the shell script file in the KVM window, nor does it require administrators to manually upload the shell script file, thus achieving automatic uploading of the shell script file to the server and automatic execution of the shell script file on the server, improving the efficiency of shell script file uploading and execution. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0029] Figure 1 This is a flowchart illustrating the shell script file execution method provided by the present invention;
[0030] Figure 2 This is a schematic diagram illustrating the interaction between a personal computer and a server host provided by the present invention;
[0031] Figure 3 This is the second flowchart illustrating the shell script file execution method provided by the present invention;
[0032] Figure 4 This is a schematic diagram of the structure of the shell script file execution device provided by the present invention;
[0033] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0035] The following is combined Figures 1-5 This invention describes a method, apparatus, and electronic device for executing shell script files.
[0036] This invention provides a method for executing a shell script file, comprising:
[0037] Step 110: When a shell script file is detected to be dragged and dropped into the KVM (Keyboard VideoMouse) window of the computer terminal, the dragged shell script file is obtained and uploaded to the target path of the Baseboard Management Controller (BMC).
[0038] It is understood that the method provided by this invention can be executed by a computer terminal, which is also the personal computer of the administrator.
[0039] KVM redirects the server host's console to the administrator's personal computer via the baseboard management controller. The administrator can log in to the baseboard management controller's management interface through a browser and open a KVM window. The server host screen will be displayed in the KVM window, and the administrator can remotely control the server host using the keyboard and mouse on their personal computer. A specific diagram illustrating the interaction between the administrator's personal computer and the server host is shown below. Figure 2 As shown.
[0040] The KVM window is displayed on the administrator's personal computer. Through the redirection function of the baseboard management controller, the operations performed by the administrator in the KVM window can be applied to the server host.
[0041] The execution window of a shell script file is a program written in C that provides an interface through which users can access the operating system's kernel services.
[0042] Administrators can drag and drop shell script files from their personal computers onto the KVM window of the baseboard management controller's management interface using a mouse. The KVM window can be written in web code, which can include HTML, CSS, JavaScript, Vue, and other code. The baseboard management controller monitors whether shell script files are being dragged and dropped into the KVM window. Specifically, when a file is detected being dragged and dropped into the KVM window, the dragged file is identified, and it is determined whether the dragged file is a shell script file.
[0043] If the KVM window of the baseboard management controller detects that a shell script file has been dragged into the KVM window, it will recognize the dragged shell script file and upload it to the target path in the baseboard management controller.
[0044] In other embodiments, a Java program set up on the administrator's personal computer can detect whether a shell script file has been dragged and dropped into the KVM window. The KVM window does not need to monitor the shell script file. When the Java program detects that a shell script file has been dragged and dropped into the KVM window, it sends a command to the KVM window to notify the KVM window that a shell script file has been dragged and dropped into the window.
[0045] Step 120: If a shell script file to be processed is detected in the target path of the baseboard management controller, the virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to execute the shell script file created in the target path of the server host.
[0046] It is understood that the baseboard management controller always runs a shell script processing process, which continuously checks whether there is a shell script file to be processed in the target path of the baseboard management controller. When the shell script processing process detects that there is a shell script file to be processed in the target path of the baseboard management controller, it calls the virtual input device. The virtual input device can be a virtual keyboard. In other embodiments, the virtual input device can be a mouse.
[0047] In the firmware code of the baseboard management controller, a virtual keyboard handler is designed. This program can simulate a USB device, and combined with specific driver code, it simulates the function of a physical keyboard to replace the physical keyboard on the administrator's personal computer. This allows the operation of the physical keyboard on the personal computer to be transferred from the baseboard management controller to the server host. The target path on the server host is the file path located on the server host.
[0048] In some embodiments, uploading the dragged shell script file to the target path of the baseboard management controller includes:
[0049] If the file size of the dragged shell script file is less than a preset threshold, the dragged shell script file is uploaded to the target path of the baseboard management controller.
[0050] Understandably, the preset threshold can be set according to actual needs. For example, the threshold can be set to a size of 32KB, 64KB, or 128KB bytes.
[0051] The target path for the baseboard management controller is the folder path used to store shell script files within the baseboard management controller. The target path for the baseboard management controller can be a single path or multiple paths. If multiple paths exist, the shell script files can be categorized and stored according to their size in bytes.
[0052] By comparing the dragged shell script file with a preset threshold, large shell script files are avoided from being uploaded to the target path of the baseboard management controller, thus avoiding excessive consumption of the baseboard management controller's resources and affecting its normal operation.
[0053] In some embodiments, creating a shell script file identical to the shell script file to be processed in the target path of the server host, and controlling the server host to open a shell window to execute the shell script file created in the target path of the server host, includes:
[0054] Block input from physical input devices and create a shell script file identical to the shell script file to be processed in the target path of the server host;
[0055] After the shell script file identical to the shell script file to be processed is created, the input of the physical input device is restarted.
[0056] Understandably, blocking input from physical input devices can prevent conflicts between physical input devices and the simulated keyboard, thus making it impossible to determine the specific file created under the target path on the server host.
[0057] It should be noted that the physical input device in this embodiment is the physical input device on the administrator's personal computer, such as a keyboard or mouse.
[0058] Create a shell script file identical to the shell script file to be processed in the target path on the server host. This means copying the shell script file to be processed to the target path on the server host. The target path on the server host is the specified folder path on the server host. There can be one or more server host paths; if there are multiple server host paths, different types of shell script files can be stored in different server host paths.
[0059] After creating the shell script file identical to the one to be processed, reopen input on the physical input device. This allows for real-time responses to input from the physical input device, preventing disruption to its normal operation. The physical input device can be a physical keyboard, mouse, or monitor, among other devices.
[0060] In some embodiments, obtaining the dragged shell script file includes:
[0061] Based on the data interface of the baseboard management controller, the dragged shell script file is obtained from the computer terminal;
[0062] The data interface of the baseboard management controller is implemented based on Hypertext Transfer Protocol Secure (HTTPS) or Trivial File Transfer Protocol (TFTP).
[0063] Understandably, the baseboard management controller firmware code implements a file upload interface, which can use either the Hypertext Transfer Protocol Secure (HTTP) or the Simple File Transfer Protocol (SLTP). This file upload interface can be called by the baseboard management controller's web code to upload shell script files to the target path on the baseboard management controller.
[0064] The Hypertext Transfer Security Protocol (HTTP) is a secure channel built upon HTTP, ensuring security during transmission through encryption and authentication. HTTP's security is built upon the foundation of HTTP by adding a Secure Socket Layer (SSL). The details of encryption are handled by the SSL layer. HTTP uses a different default port than HTTP and an encryption / authentication layer (between HTTP and TCP). Therefore, writing files to the target path on a server host using HTTP offers high security.
[0065] The Simple File Transfer Protocol (SLTP) is a simple protocol for transferring files, based on the User Datagram Protocol (UDP). SLTP is designed for small file transfers; therefore, it lacks many features of typical file transfer protocols (FTP). SLTP can only retrieve or write files to a file server, cannot list directories, does not perform authentication, and transmits 8-bit data. SLTP uses three transmission modes: netascii (8-bit ASCII), octet (8-bit source data), and mail (which is no longer supported and returns data directly to the user instead of saving it to a file). Therefore, SLTP is highly efficient for writing files to the target path on the server host.
[0066] In some embodiments, creating a shell script file identical to the shell script file to be processed in the target path of the server host includes:
[0067] The shell script file to be processed is validated. If the shell script file to be processed meets the preset rules, a shell script file identical to the shell script file to be processed is created in the target path of the server host.
[0068] Understandably, users can pre-define verification rules for shell script files. A shell verification program can generate a relatively small, unique key from the file, which can then be recalculated to check for file alterations. Modification of shell script files can be intentional (e.g., adding a new user changes the password file), unintentional (e.g., reading incorrect data from a CD-ROM), or even malicious (e.g., inserting a virus). Verifying the shell script file before processing verifies whether the data it contains matches expectations. Therefore, verifying the shell script file before processing prevents its tampering.
[0069] In some embodiments, the method for executing a shell script file further includes:
[0070] The KVM window displays the execution process and results of the shell script file.
[0071] It is understandable that a shell script file identical to the shell script file to be processed is created in the target path of the server host. When the newly created shell script file is executed in the target path of the server host, the process and result of the shell script execution are displayed in real time through the KVM window of the baseboard management controller management interface, so that the administrator can monitor the execution process of the shell script file in real time.
[0072] In some embodiments, the shell script file is a single shell script file, multiple shell script files, or a compressed package of shell script files.
[0073] Understandably, when a shell script file corresponds to a single program function, a single shell script file can be used; when a shell script file corresponds to multiple different program functions, multiple shell script files can be used; and when the shell script file has a large number of bytes, a compressed shell script file package can be used to save resources.
[0074] When there are multiple shell script files, multiple threads can be started to call the virtual input device and simultaneously create multiple shell script files identical to the shell script file to be processed on the target path of the server host. Alternatively, a single thread can be started to call the virtual input device and sequentially create multiple shell script files identical to the shell script file to be processed on the target path of the server host.
[0075] In other embodiments provided by the present invention, such as Figure 3 As shown, the execution methods of a shell script file include:
[0076] Step 310: Drag the shell script from your personal computer to the KVM window of the baseboard management controller management interface using the mouse;
[0077] Step 320: The web code of the baseboard management controller captures the drag-and-drop event and calls the file upload interface to upload the shell script to the specified path of the baseboard management controller;
[0078] Step 330: The baseboard management controller file processing process reads the contents of the shell script file, invokes the virtual keyboard, and generates a shell script file with the same name and content in the specified path on the server host. It then opens a shell window and executes the file.
[0079] Step 340: The BMC management interface KVM window displays the execution process and results of the shell script in real time.
[0080] In summary, the shell script file execution method provided by the present invention includes: when a shell script file is detected to be dragged and dropped into a KVM window of a computer terminal, obtaining the dragged shell script file and uploading the dragged shell script file to a target path of a baseboard management controller; when a shell script file to be processed is detected to exist in the target path of the baseboard management controller, invoking a virtual input device to create a shell script file identical to the shell script file to be processed in the target path of a server host, and controlling the server host to open a shell window to execute the shell script file created in the target path of the server host.
[0081] In the shell script file execution method provided by this invention, a shell script file identical to the shell script file dragged to the KVM window is created in the target path of the server host by calling a virtual input device, and the server host is controlled to open a shell window to execute the created shell script file. This process does not require administrators to manually enter the shell script file in the KVM window, nor does it require administrators to manually upload the shell script file, thus realizing automatic uploading of the shell script file to the server and automatic execution of the shell script file on the server, improving the efficiency of shell script file uploading and execution.
[0082] The shell script file execution device provided by the present invention is described below. The shell script file execution device described below can be referred to in correspondence with the shell script file execution method described above.
[0083] like Figure 4 As shown, the present invention also provides a shell script file execution device 400, comprising:
[0084] The upload module 410 is used to obtain the dragged shell script file when it is detected that the shell script file is dragged and dropped into the KVM window of the computer terminal, and upload the dragged shell script file to the target path of the baseboard management controller.
[0085] As can be understood, KVM redirects the server host's console to the administrator's personal computer via the baseboard management controller. The administrator can log into the baseboard management controller's management interface through a browser and open a KVM window. The server host screen will be displayed in the KVM window, and the administrator can remotely control the server host using the keyboard and mouse on their personal computer. Specifically, a diagram illustrating the interaction between the administrator's personal computer and the server host is shown below. Figure 2 As shown.
[0086] The KVM window is displayed on the administrator's personal computer. Through the redirection function of the baseboard management controller, the operations performed by the administrator in the KVM window can be applied to the server host.
[0087] The execution window of a shell script file is a program written in C that provides an interface through which users can access the operating system's kernel services.
[0088] Administrators can drag and drop shell script files from their personal computers onto the KVM window of the baseboard management controller's management interface using a mouse. The KVM window can be written in web code, which can include HTML, CSS, JavaScript, Vue, and other code. The baseboard management controller monitors whether shell script files are being dragged and dropped into the KVM window. Specifically, when a file is detected being dragged and dropped into the KVM window, the dragged file is identified, and it is determined whether the dragged file is a shell script file.
[0089] If the KVM window of the baseboard management controller detects that a shell script file has been dragged into the KVM window, it will recognize the dragged shell script file and upload it to the target path in the baseboard management controller.
[0090] In other embodiments, a Java program set up on the administrator's personal computer can detect whether a shell script file has been dragged and dropped into the KVM window. The KVM window does not need to monitor the shell script file. When the Java program detects that a shell script file has been dragged and dropped into the KVM window, it sends a command to the KVM window to notify the KVM window that a shell script file has been dragged and dropped into the window.
[0091] The creation module 420 is used to, when a shell script file to be processed is detected in the target path of the baseboard management controller, call the virtual input device to create a shell script file identical to the shell script file to be processed in the target path of the server host, and control the server host to open a shell window to execute the shell script file created in the target path of the server host.
[0092] It is understood that the baseboard management controller always runs a shell script processing process, which continuously checks whether there is a shell script file to be processed in the target path of the baseboard management controller. When the shell script processing process detects that there is a shell script file to be processed in the target path of the baseboard management controller, it calls the virtual input device. The virtual input device can be a virtual keyboard. In other embodiments, the virtual input device can be a mouse.
[0093] In the firmware code of the baseboard management controller, a virtual keyboard handler is designed. This program can simulate a USB device, and combined with specific driver code, it simulates the function of a physical keyboard to replace the physical keyboard on the administrator's personal computer. This allows the operation of the physical keyboard on the personal computer to be transferred from the baseboard management controller to the server host. The target path on the server host is the file path located on the server host.
[0094] In some embodiments, the upload module 410 is further configured to upload the dragged shell script file to the target path of the baseboard management controller if the file size of the dragged shell script file is less than a preset threshold.
[0095] In some embodiments, module 420 is created, including:
[0096] A creation unit is used to block input from physical input devices and create a shell script file identical to the shell script file to be processed in the target path of the server host.
[0097] The restart unit is used to restart the input of the entity input device after the shell script file identical to the shell script file to be processed has been created.
[0098] In some embodiments, the upload module 410 further obtains the dragged shell script file from the computer terminal based on the data interface of the baseboard management controller;
[0099] The data interface of the baseboard management controller is an interface implemented based on the Hypertext Transfer Security Protocol or the Simple File Transfer Protocol.
[0100] In some embodiments, the creation unit is further configured to verify the shell script file to be processed, and if it is determined that the shell script file to be processed meets the preset rules, create a shell script file identical to the shell script file to be processed in the target path of the server host.
[0101] In some embodiments, the shell script file execution device 400 further includes:
[0102] The display module (not shown in the figure) is used to display the execution process and results of the shell script file based on the KVM window.
[0103] In some embodiments, the shell script file is a single shell script file, multiple shell script files, or a compressed package of shell script files.
[0104] The shell script execution device provided by this invention creates a shell script file identical to the shell script file dragged to the KVM window in the target path of the server host by calling a virtual input device, and controls the server host to open a shell window to execute the created shell script file. This process does not require administrators to manually enter the shell script file in the KVM window, nor does it require administrators to manually upload the shell script file, thus achieving automatic uploading of the shell script file to the server and automatic execution of the shell script file on the server, improving the efficiency of shell script file uploading and execution.
[0105] The electronic device, computer program product, and storage medium provided by the present invention are described below. The electronic device, computer program product, and storage medium described below can be referred to in correspondence with the execution method of the shell script file described above.
[0106] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute the execution method of a shell script file, the method including:
[0107] If a shell script file is detected being dragged and dropped into the KVM window of the computer terminal, the dragged shell script file is retrieved and uploaded to the target path of the baseboard management controller.
[0108] If a shell script file to be processed is detected in the target path of the baseboard management controller, a virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to execute the shell script file created in the target path of the server host.
[0109] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0110] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer being able to execute the shell script file execution method provided by the above methods, the method comprising:
[0111] If a shell script file is detected being dragged and dropped into the KVM window of the computer terminal, the dragged shell script file is retrieved and uploaded to the target path of the baseboard management controller.
[0112] If a shell script file to be processed is detected in the target path of the baseboard management controller, a virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to execute the shell script file created in the target path of the server host.
[0113] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an execution method for executing the shell script file provided by the methods described above, the method comprising:
[0114] If a shell script file is detected being dragged and dropped into the KVM window of the computer terminal, the dragged shell script file is retrieved and uploaded to the target path of the baseboard management controller.
[0115] If a shell script file to be processed is detected in the target path of the baseboard management controller, a virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to execute the shell script file created in the target path of the server host.
[0116] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for executing a shell script file, characterized in that, include: If a shell script file is detected being dragged and dropped into the KVM window of the computer terminal, the dragged shell script file is retrieved and uploaded to the target path of the baseboard management controller. If a shell script file to be processed is detected in the target path of the baseboard management controller, the virtual input device is invoked to create a shell script file identical to the shell script file to be processed in the target path of the server host, and the server host is controlled to open a shell window to transfer the operation of the physical keyboard on the personal computer from the baseboard management controller to the server host to execute the shell script file created in the target path of the server host. The step of creating a shell script file identical to the shell script file to be processed in the target path of the server host, and controlling the server host to open a shell window to execute the shell script file created in the target path of the server host, includes: Block input from physical input devices and create a shell script file identical to the shell script file to be processed in the target path of the server host; After the shell script file identical to the shell script file to be processed is created, the input of the physical input device is restarted.
2. The method for executing a shell script file according to claim 1, characterized in that, Uploading the dragged shell script file to the target path of the baseboard management controller includes: If the file size of the dragged shell script file is less than a preset threshold, the dragged shell script file is uploaded to the target path of the baseboard management controller.
3. The method for executing a shell script file according to claim 1, characterized in that, The process of obtaining the dragged shell script file includes: Based on the data interface of the baseboard management controller, the dragged shell script file is obtained from the computer terminal; The data interface of the baseboard management controller is an interface implemented based on the Hypertext Transfer Security Protocol or the Simple File Transfer Protocol.
4. The method for executing a shell script file according to claim 1, characterized in that, Creating a shell script file identical to the shell script file to be processed in the target path of the server host includes: The shell script file to be processed is validated. If the shell script file to be processed meets the preset rules, a shell script file identical to the shell script file to be processed is created in the target path of the server host.
5. The method for executing a shell script file according to claim 1, characterized in that, Also includes: The KVM window displays the execution process and results of the shell script file.
6. The method for executing a shell script file according to any one of claims 1-5, characterized in that, The shell script file can be a single shell script file, multiple shell script files, or a compressed package of shell script files.
7. A shell script file execution device, characterized in that, include: The upload module is used to obtain the dragged shell script file when it is detected that a shell script file has been dragged and dropped into the KVM window of the computer terminal, and upload the dragged shell script file to the target path of the baseboard management controller. A creation module is used to, when a shell script file to be processed is detected in the target path of the baseboard management controller, call a virtual input device to create a shell script file identical to the shell script file to be processed in the target path of the server host, and control the server host to open a shell window to transfer the operation of the physical keyboard on the personal computer from the baseboard management controller to the server host to execute the shell script file created in the target path of the server host. The module is specifically used for: Block input from physical input devices and create a shell script file identical to the shell script file to be processed in the target path of the server host; After the shell script file identical to the shell script file to be processed is created, the input of the physical input device is restarted.
8. 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 program, it implements the method for executing the shell script file as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the execution method of the shell script file as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Script file execution method and device, equipment, storage medium and program product
CN114691238A
System and Method for Server Information Handling System Management Through Local I / O Devices
US20080005222A1
