Batch modification method and system for application configuration
By traversing the application directory on the application server, batch execution of configuration files backup, replacement, inspection, fallback, and batch stop and start of application processes, the problem of manual operation is solved and the efficiency of online operations is improved.
Patent Information
- Application Number
- CN202411568664.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-04-08
AI Technical Summary
During the upgrade of the technical framework of the IT system, manual backup, modification, inspection, fallback, and start and stop a single application process are inefficient, resulting in inefficient online operations.
By traversing the application directory on the application server, batch-execute backup, replacement, checking, falling back of configuration files or scripts, as well as batch stop and start of application processes, batch modification of configuration files can be achieved.
It solves the problem of inefficiency in manual operations, improves the work efficiency of online operations, and simplifies the process of configuration file management and application process management.
Smart Images

Figure CN119781849A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software configuration management, and in particular to a method for batch modifying application configurations and a system for batch modifying application configurations. Background Art
[0002] When upgrading the technical framework of an IT system, it is usually done in a cluster on physical or virtual machines, and some traditional J2EE framework applications or some microservice architecture applications that lack a configuration center are running. These applications have a large number of configuration files, and the configuration items in the files are even more.
[0003] Assume that the key value of some configuration needs to be modified. The value needs to be searched on each server one by one. During this period, operations such as stopping the application, making backups, changing configurations, checking, and starting the application need to be performed. If the test fails, rollback operations are also involved, and the online operation efficiency is low. Summary of the invention
[0004] In response to the above problems, the present invention provides a method and system for batch modification of application configurations. By traversing the application directory on the application server, batch execution of configuration files or scripts backup, replacement, inspection, rollback, and batch stop and start of application processes and other operations can be solved. The low efficiency problem of manual configuration file backup, modification, inspection, rollback and start and stop of a single application process can be solved, thereby improving the work efficiency of online operations.
[0005] To achieve the above object, the present invention provides a method for batch modification of application configurations, comprising:
[0006] After stopping the applications in batches, starting the applications in batches;
[0007] Traverse and search for files that meet preset conditions in the directory of the application, and batch back up the found files;
[0008] Traverse and search for files that meet preset conditions in the directory of the application, and replace and modify the key strings in the found files;
[0009] Searching the directory of the application for files that meet the preset conditions, and displaying the content that meets the preset conditions;
[0010] The directory of the application is searched for files that meet preset conditions, and the found files are deleted, and the corresponding files backed up in advance are copied as new files.
[0011] In the above technical solution, preferably, the batch-starting the applications after batch-stopping the applications specifically includes:
[0012] Annotate the application self-start script, stop the applications in batches, and rename the application logs;
[0013] The applications are started in batches, and the self-starting script is uncommented.
[0014] In the above technical solution, preferably, the traversal to find files that meet preset conditions in the directory of the application and batch backing up the found files specifically includes:
[0015] The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the found files are batch backed up by copying. The name of the backup file is the original file name with the preset suffix added.
[0016] In the above technical solution, preferably, the traversal to find files that meet preset conditions in the directory of the application and to replace and modify the key character strings in the found files, specifically includes:
[0017] The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the key character strings in the found files are replaced and modified in batches.
[0018] In the above technical solution, preferably, the traversal to search for files meeting preset conditions in the directory of the application and displaying the content that meets the preset conditions, specifically includes:
[0019] The directory of the application is traversed to search for files containing preset keywords, matching preset file suffixes and excluding special file names, and the found file names and line contents matching the keywords are displayed.
[0020] In the above technical solution, preferably, the traversal searches for files that meet preset conditions in the directory of the application, deletes the found files, and copies the corresponding files backed up in advance as new files, and specifically includes:
[0021] Traverse the directory of the application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.
[0022] The present invention further proposes a system for batch modification of application configurations, which uses a method for batch modification of application configurations disclosed in any one of the above technical solutions, including:
[0023] A batch start-stop module, used to batch-start the applications after stopping them in batches;
[0024] A batch backup module, used to traverse and search for files that meet preset conditions in the directory of the application, and batch back up the found files;
[0025] A batch modification module is used to traverse and search for files that meet preset conditions in the directory of the application, and replace and modify key strings in the found files;
[0026] A batch checking module is used to search the directory of the application for files that meet the preset conditions, and display the content that meets the preset conditions;
[0027] The batch rollback module is used to traverse and search for files that meet preset conditions in the directory of the application, delete the found files, and copy the corresponding files that were backed up in advance as new files.
[0028] In the above technical solution, preferably, the batch start-stop module is specifically used for:
[0029] Annotate the application self-start script, stop the applications in batches, and rename the application logs;
[0030] The applications are started in batches, and the self-starting script is uncommented.
[0031] In the above technical solution, preferably, the batch backup module is specifically used for:
[0032] Traverse the directory of the application to find files containing preset keywords and matching preset file suffixes and excluding special file names, and batch back up the found files by copying them. The name of the backup file is the original file name with the preset suffix added.
[0033] The batch modification module is specifically used for:
[0034] The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the key character strings in the found files are replaced and modified in batches.
[0035] In the above technical solution, preferably, the batch inspection module is specifically used for:
[0036] Traverse the directory of the application to find files containing preset keywords and matching preset file suffixes and excluding special file names, and display the found file names and line contents matching the keywords;
[0037] The batch rollback module is specifically used for:
[0038] Traverse the directory of the application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.
[0039] Compared with the prior art, the beneficial effects of the present invention are: by traversing the application directory on the application server, batch execution of configuration files or scripts backup, replacement, inspection, rollback, and batch stop, start and other operations of application processes, the low efficiency problem of manual configuration file backup, modification, inspection, rollback and start and stop of a single application process is solved, and the efficiency of online operations is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a flow chart of a method for batch modification of application configurations disclosed in an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of modules of a batch modification system for application configuration disclosed in an embodiment of the present invention.
[0042] In the figure, the corresponding relationship between each component and the reference numeral is as follows:
[0043] 1. Batch start and stop module, 2. Batch backup module, 3. Batch modification module, 4. Batch inspection module, 5. Batch rollback module. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0046] like Figure 1 As shown, a method for batch modification of application configurations provided by the present invention includes:
[0047] After stopping applications in batches, start them in batches;
[0048] Traverse the application directory to find files that meet the preset conditions, and back up the found files in batches;
[0049] Traverse the application directory to find files that meet the preset conditions, and replace and modify the key strings in the found files;
[0050] Traverse the application directory to find files that meet the preset conditions, and display the content that meets the preset conditions;
[0051] Traverse the application directory to find files that meet the preset conditions, delete the found files, and copy the corresponding files backed up in advance as new files.
[0052] In this implementation, by traversing the application directory on the application server and performing operations such as backing up, replacing, checking, and rolling back configuration files or scripts, and stopping and starting application processes in batches, the inefficiency problem of manually backing up, modifying, checking, and rolling back configuration files one by one, and starting and stopping a single application process is solved, thereby improving the efficiency of online operations.
[0053] In the above implementation, preferably, after stopping the applications in batches, starting the applications in batches specifically includes:
[0054] Comment the application's self-start script to prevent the application process from being started again by the self-start script after the application is stopped. Stop the applications in batches and rename the application logs.
[0055] Start the applications in batches and uncomment the auto-start script.
[0056] In the above implementation, preferably, the files meeting the preset conditions in the directory of the application are traversed and the found files are backed up in batches. The specific process includes:
[0057] Traverse the application directory to find files that contain preset keywords and match preset file suffixes, and exclude special file names. Then copy the found files for batch backup. The name of the backup file is the original file name with the preset suffix added.
[0058] In the above implementation, preferably, the files meeting the preset conditions in the directory of the application are traversed and the key character strings in the found files are replaced and modified. The specific process includes:
[0059] Traverse the directory of the search application to find files that contain preset keywords, match the preset file suffix and exclude special file names, and batch replace and modify the key strings in the found files.
[0060] In the above implementation, preferably, the files meeting the preset conditions in the directory of the application are traversed and the content meeting the preset conditions is displayed. The specific process includes:
[0061] Traverse the directory of the search application to find files that contain preset keywords and match the preset file suffix and exclude special file names, and display the file names and line contents that match the keywords.
[0062] In the above implementation, preferably, the files meeting the preset conditions in the directory of the application are traversed and the found files are deleted, and the corresponding files backed up in advance are copied as new files, and the specific contents include:
[0063] Traverse the directory of the search application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.
[0064] like Figure 2 As shown, the present invention further proposes a system for batch modification of application configurations, applying a method for batch modification of application configurations disclosed in any one of the above embodiments, including:
[0065] Batch start and stop module 1, used to batch stop applications and then start them in batches;
[0066] Batch backup module 2, used to traverse and search for files that meet preset conditions in the application directory, and batch back up the found files;
[0067] Batch modification module 3, used to traverse and search for files that meet preset conditions in the application directory, and replace and modify the key strings in the found files;
[0068] Batch checking module 4, used to traverse and search for files that meet preset conditions in the application directory, and display the content that meets the preset conditions;
[0069] The batch rollback module 5 is used to traverse and search for files that meet preset conditions in the application directory, delete the found files, and copy the corresponding files backed up in advance as new files.
[0070] In the above implementation, preferably, the batch start-stop module 1 is specifically used for:
[0071] Comment the application's self-start script, stop the applications in batches, and rename the application's logs;
[0072] Start the applications in batches and uncomment the auto-start script.
[0073] In the above implementation, preferably, the batch backup module 2 is specifically used for:
[0074] Traverse the application directory to find files that contain preset keywords and match preset file suffixes, excluding special file names, and copy the found files for batch backup. The name of the backup file is the original file name with the preset suffix added.
[0075] Batch modification module 3 is specifically used for:
[0076] Traverse the directory of the search application to find files that contain preset keywords, match the preset file suffix and exclude special file names, and batch replace and modify the key strings in the found files.
[0077] In the above implementation, preferably, the batch inspection module 4 is specifically used for:
[0078] Traverse the directory of the search application to find files that contain preset keywords and match preset file suffixes and exclude special file names, and display the file names and line contents that match the keywords found;
[0079] The batch rollback module 5 is specifically used for:
[0080] Traverse the directory of the search application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.
[0081] According to the batch modification system of application configuration disclosed in the above implementation, the functions to be implemented by each module thereof correspond to the steps of the batch modification method of application configuration disclosed in the above implementation. During the implementation process, the operations are performed with reference to the above implementation, which will not be repeated here.
[0082] According to the batch modification method and system of application configuration disclosed in the above implementation mode, during the implementation, the normal online process is as follows:
[0083] (1) Run the batch shutdown script sh batchshutdown.sh;
[0084] (2) Run the batch backup script sh batchbackup.sh;
[0085] (3) Run the batch modification script sh batchreplace.sh;
[0086] (4) Run the batch check script sh batchcheck.sh;
[0087] (5) Run the batch startup script sh batchstartup.sh.
[0088] The rollback actions for online test failure include:
[0089] (1) Run the batch shutdown script sh batchshutdown.sh;
[0090] (2) Run the batch fallback script sh batchfallback.sh;
[0091] (3) Run the batch check script sh batchcheck.sh;
[0092] (4) Run the batch startup script sh batchstartup.sh.
[0093] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for batch modification of application configuration, characterized in that: include: After stopping the applications in batches, starting the applications in batches; Traverse and search for files that meet preset conditions in the directory of the application, and batch back up the found files; Traverse and search for files that meet preset conditions in the directory of the application, and replace and modify the key strings in the found files; Searching the directory of the application for files that meet the preset conditions, and displaying the content that meets the preset conditions; The directory of the application is searched for files that meet preset conditions, and the found files are deleted, and the corresponding files backed up in advance are copied as new files.
2. The method for batch modification of application configuration according to claim 1, characterized in that: The batch-starting of the applications after batch-stopping the applications specifically includes: Annotate the application self-start script, stop the applications in batches, and rename the application logs; The applications are started in batches, and the self-starting script is uncommented.
3. The method for batch modification of application configuration according to claim 1, characterized in that: The traversal searches for files that meet preset conditions in the directory of the application, and backs up the found files in batches. The specific process includes: The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the found files are batch backed up by copying. The name of the backup file is the original file name with the preset suffix added.
4. The method for batch modification of application configuration according to claim 3, characterized in that: The traversal searches for files that meet preset conditions in the directory of the application, and replaces and modifies key strings in the found files. The specific process includes: The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the key character strings in the found files are replaced and modified in batches.
5. The method for batch modification of application configuration according to claim 4, characterized in that: The traversal searches for files that meet preset conditions in the directory of the application, and displays the content that meets the preset conditions. The specific process includes: The directory of the application is traversed to search for files containing preset keywords, matching preset file suffixes and excluding special file names, and the found file names and line contents matching the keywords are displayed.
6. The method for batch modification of application configuration according to claim 5, characterized in that: The traversal searches for files that meet preset conditions in the directory of the application, deletes the found files, and copies the corresponding files backed up in advance as new files, and the specific contents include: Traverse the directory of the application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.
7. A batch modification system for application configuration, characterized in that: The method for batch modifying application configuration according to any one of claims 1 to 6 comprises: A batch start-stop module, used to batch-start the applications after stopping them in batches; A batch backup module, used to traverse and search for files that meet preset conditions in the directory of the application, and batch back up the found files; A batch modification module is used to traverse and search for files that meet preset conditions in the directory of the application, and replace and modify key strings in the found files; A batch checking module is used to search the directory of the application for files that meet the preset conditions, and display the content that meets the preset conditions; The batch rollback module is used to traverse and search for files that meet preset conditions in the directory of the application, delete the found files, and copy the corresponding files that were backed up in advance as new files.
8. The batch modification system for application configuration according to claim 7, characterized in that: The batch start-stop module is specifically used for: Annotate the application self-start script, stop the applications in batches, and rename the application logs; The applications are started in batches, and the self-starting script is uncommented.
9. The batch modification system for application configuration according to claim 8, characterized in that: The batch backup module is specifically used for: Traverse the directory of the application to find files containing preset keywords and matching preset file suffixes and excluding special file names, and batch back up the found files by copying them. The name of the backup file is the original file name with the preset suffix added. The batch modification module is specifically used for: The directory of the application is traversed to find files containing preset keywords, matching preset file suffixes and excluding special file names, and the key character strings in the found files are replaced and modified in batches.
10. The batch modification system for application configuration according to claim 9, characterized in that: The batch inspection module is specifically used for: Traverse the directory of the application to find files containing preset keywords and matching preset file suffixes and excluding special file names, and display the found file names and line contents matching the keywords; The batch rollback module is specifically used for: Traverse the directory of the application to find files that contain preset keywords, match preset file suffixes and exclude special file names. After deleting the found files, use the pre-backed-up files to copy new files, and modify the new file name to the original file name with the suffix deleted.