CN-121979559-A - Automatic generating system and method for Linux system service configuration
Abstract
The application relates to the technical field of operation and maintenance of Linux systems, in particular to an automatic generation system and method for service configuration of a Linux system, comprising an interaction module, a configuration generation module, a registration and validation module and a verification feedback module, wherein the interaction module is used for receiving service configuration parameters input by a user, the configuration generation module is used for generating a configuration file conforming to a system service management specification according to version information of the Linux system and the service configuration parameters, the registration and validation module is used for storing the generated configuration file to a service catalog predefined by the Linux system and automatically executing a system command sequence to finish service registration and validation, and the verification feedback module is used for carrying out grammar validity check on the generated configuration file and carrying out multi-level check on a service starting state to generate feedback information containing a check result. Therefore, the method for automatically generating the service configuration file conforming to systemd specifications can reduce the configuration threshold, improve the configuration accuracy and the deployment efficiency, and meet the high-frequency and high-reliability service configuration requirements in special scenes such as a transformer substation monitoring system.
Inventors
- LI ZHAO
- Zhou Renhang
- CHEN LIN
- HAN MAOLIN
- JI YUPENG
- FENG YUHAO
- PANG XUDONG
- CHEN YAO
- HU HAI
Assignees
- 长园深瑞继保自动化有限公司
- 长园科技集团股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251219
Claims (10)
- 1. An automatic Linux system service configuration generation system, comprising: the interaction module is used for receiving service configuration parameters input by a user, wherein the service configuration parameters at least comprise one or more of service names, service descriptions, starting commands, script paths, operation users, restarting strategies and dependent services; the configuration generation module is used for generating a configuration file which accords with the system service management specification according to version information of the Linux system and the service configuration parameters; the registration validation module is used for saving the generated configuration file to a service directory predefined by the Linux system, and automatically executing a system command sequence to finish service registration and validation, wherein the system command sequence at least comprises a configuration reload command, a starting self-starting setting command and a service starting command; The verification feedback module is used for carrying out grammar validity check on the generated configuration file and carrying out multi-level check on the service starting state to generate feedback information containing check results, wherein the multi-level check at least comprises one or more of service instant state check, service detailed state acquisition, service log analysis and service dependent health check.
- 2. The system of claim 1, wherein the service configuration parameters received by the interaction module further comprise environment variable parameters, working directory parameters; The interaction module provides a key value pair table for receiving environment variable parameter input, a file browser selection interface and a manual input box for receiving working directory parameter input.
- 3. The system according to claim 1, wherein the interaction module is provided with an operation identity configuration unit comprising a dynamic user check box and an operation user drop down menu; if the user checks the dynamic user check box, the interaction module records dynamic user starting parameters; And if the user does not check the dynamic user check box, the interaction module records the specific operation user identity information selected by the user from the operation user drop-down menu.
- 4. The apparatus of claim 1, wherein the interaction module is provided with a structured dependency configuration area comprising a plurality of independent input boxes for receiving a strongly dependent service parameter, a weakly dependent service parameter, a start-up sequence parameter, respectively, of user input, each dependent parameter being entered in a space-separated form.
- 5. The apparatus according to claim 1, wherein the configuration generation module is specifically configured to: And respectively corresponding the service configuration parameters input by the user to the unit block, the service block and the installation block of the configuration file according to a preset mapping rule to generate complete configuration content comprising block identifiers, parameter names and parameter values, wherein the installation block at least comprises target dependent parameters.
- 6. The apparatus of claim 1, wherein the configuration generation module is further configured to: invoking a system service grammar check command to carry out grammar check on the generated configuration file; if grammar errors exist, highlighting the error positions on a graphical interaction interface through the interaction module and prompting correction suggestions, and stopping the subsequent execution of the registration validation module.
- 7. The apparatus of claim 1, wherein the step of the authentication feedback module performing a service instant status check is specifically: executing a service state inquiry command to acquire a service state; If the returned service state is running, judging that the instant starting is normal; If the returned service state is failed in starting or is not operated, the instant starting abnormality is judged.
- 8. The apparatus of claim 1, wherein the step of the verification feedback module performing service detail status acquisition is specifically: executing the service detailed state command obtains the exit code, the running time and the memory occupation information of the service.
- 9. The apparatus of claim 1, wherein the step of the verification feedback module performing service log analysis is specifically: Executing a service log inquiry command to acquire the latest log information of the preset number of services; Carrying out keyword scanning on the log information, and highlighting a log row containing keywords; The feedback information generated by the verification feedback module comprises success feedback information and failure feedback information; If the checking result is that the configuration is successful, the verification feedback module outputs green prompt information and a process identifier, running time and memory occupation overview of the service through the interaction module; if the checking result is that the configuration fails, the verification feedback module outputs red prompt information, failure reason classification, associated error logs and corresponding repair suggestions through the interaction module.
- 10. The automatic generating method for the Linux system service configuration is characterized by comprising the following steps: Receiving service configuration parameters input by a user, wherein the service configuration parameters at least comprise one or more of service names, service descriptions, starting commands, script paths, running users, restarting strategies and relying services; generating a configuration file conforming to a system service management specification according to version information of the Linux system and the service configuration parameters; Storing the generated configuration file into a service directory predefined by a Linux system, and automatically executing a system command sequence to finish service registration and validation, wherein the system command sequence at least comprises a configuration reload command, a startup self-starting setting command and a service starting command; Carrying out grammar validity check on the generated configuration file, carrying out multi-level check on the service starting state, and generating feedback information containing a check result; the multi-level check at least comprises one or more of a service instant status check, a service detailed status acquisition, a service log analysis and a dependent service health check.
Description
Automatic generating system and method for Linux system service configuration Technical Field The application relates to the technical field of operation and maintenance of Linux systems, in particular to an automatic generation system and method for service configuration of a Linux system. Background The substation monitoring system is used as a core infrastructure for safe operation of the power system, and the stability and reliability of the substation monitoring system directly determine the safety and continuity of power transmission. Currently, the main stream transformer substation monitoring system is operated on the Linux operating system, and in the deployment, upgrading and maintenance processes of the transformer substation monitoring system, the requirement of newly increasing the self-starting task frequently exists. The systemd system adopted by the mainstream Linux release can solve the defects of the traditional mode (through systemctl management service), but the service configuration file needs to follow strict grammar specifications and comprises a plurality of necessary filling parameters, and parameters such as a starting type, a restarting strategy and the like need to be matched with program characteristics. In addition, the substation monitoring equipment is wide in distribution and large in quantity, the repeated workload of service files is large, configuration inconsistency is easy to occur, the system has extremely high requirements on service stability, the monitoring program is possibly invalid due to configuration errors, and potential safety hazards of operation of the power equipment are caused. In summary, the existing Linux system service configuration mode has the problems of low efficiency, easiness in error, poor suitability and the like, and particularly cannot meet the high-frequency and high-reliability service configuration requirements in special scenes such as a transformer substation monitoring system and the like. Disclosure of Invention The application provides a Linux system service configuration automatic generation system and a Linux system service configuration automatic generation method, which can automatically generate a service configuration file conforming to systemd specifications, reduce a configuration threshold, improve configuration accuracy and deployment efficiency, and meet high-frequency and high-reliability service configuration requirements in special scenes such as a transformer substation monitoring system. In order to achieve the above purpose, the application adopts the following technical scheme: in a first aspect, a Linux system service configuration automatic generation system is provided, including: the interaction module is used for receiving service configuration parameters input by a user, wherein the service configuration parameters at least comprise one or more of service names, service descriptions, starting commands, script paths, operation users, restarting strategies and dependent services; the configuration generation module is used for generating a configuration file which accords with the system service management specification according to version information of the Linux system and the service configuration parameters; the registration validation module is used for saving the generated configuration file to a service directory predefined by the Linux system, and automatically executing a system command sequence to finish service registration and validation, wherein the system command sequence at least comprises a configuration reload command, a starting self-starting setting command and a service starting command; The verification feedback module is used for carrying out grammar validity check on the generated configuration file and carrying out multi-level check on the service starting state to generate feedback information containing check results, wherein the multi-level check at least comprises one or more of service instant state check, service detailed state acquisition, service log analysis and service dependent health check. In a second aspect, a method for automatically generating service configuration of a Linux system is provided, including: Receiving service configuration parameters input by a user, wherein the service configuration parameters at least comprise one or more of service names, service descriptions, starting commands, script paths, running users, restarting strategies and relying services; generating a configuration file conforming to a system service management specification according to version information of the Linux system and the service configuration parameters; Storing the generated configuration file into a service directory predefined by a Linux system, and automatically executing a system command sequence to finish service registration and validation, wherein the system command sequence at least comprises a configuration reload command, a startup self-starting setting command and a