A method, device and medium for automatically upgrading client programs
By using the upgrade mechanism of daemon and worker processes in client-server mode, the stability and upgrade efficiency of client programs are solved, and unattended automatic upgrades are achieved and downtime risks are reduced.
Patent Information
- Application Number
- CN202010717496.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-23
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-07-23
AI Technical Summary
In client-server mode, automatic upgrade of client programs faces challenges, especially when cloud services need to push data to local applications, and automated upgrades cannot be achieved, resulting in unstable upgrades and downtime.
Send upgrade packages and instructions through the server, use daemon to detect and upgrade work processes, prioritize the upgrade sequence, ensure upgrade stability, and control client program upgrades through task application mechanism, provide rollback and retry mechanisms to reduce exceptions Probability.
The unattended client program is automatically upgraded, which improves stability and upgrade efficiency, and reduces the problem of server software tasks being unable to be executed due to client downtime.
Smart Images

Figure CN112099816B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device and medium for automatically upgrading a client program, and more particularly to a method, device and medium for automatically upgrading a Java client program. Background Art
[0002] With the rapid development of big data and cloud computing technologies, more and more corporate customers are choosing cloud services to meet their management needs. Since cloud service data is stored on the Internet, companies cannot achieve all management needs through cloud services due to security, confidentiality, technology and other reasons. In the big data era, centralized data can play the greatest value, giving rise to the need for integration between various cloud services and local applications. Due to the security and confidentiality requirements of local applications, it is almost impossible for cloud services to access local applications. When there is a need for cloud services to push data to local applications, problems arise because local applications cannot provide services for cloud service software on the Internet to call.
[0003] The solution to this problem is to place client agent software dedicated to cloud services in the local network as an extension of the cloud service software in the local network. For this solution, when the upgrade of the cloud service software depends on the update of the client software, the cloud service software will actively request the client software to update. Usually, in the client-server mode, the client automatically checks for updates and decides whether to install the updates. Summary of the invention
[0004] The present invention aims to solve the following technical problems at least to some extent:
[0005] The client program automatically upgrades in client and server modes.
[0006] A first aspect of an embodiment of the present invention provides a method for automatically upgrading a client program, comprising:
[0007] Receiving a client program upgrade task instruction sent by a server and an upgrade package corresponding to the upgrade task instruction;
[0008] The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process.
[0009] The example of the present invention realizes the control of the server over the client program upgrade, without the need for the client-side personnel to participate in the update. The method of the present invention has high applicability in situations where the client location cannot be easily accessed or the server software depends on the client program update. At the same time, through the daemon process, the stability of the client program is greatly improved, which greatly reduces the problem of the server software task being unable to execute due to the client downtime.
[0010] In one example, through the upgrade package, it is first determined whether to upgrade the program corresponding to the daemon process, and then it is determined whether to upgrade the program corresponding to the working process.
[0011] The embodiment of the present invention determines the upgrade priorities of the daemon process and the working process, thereby improving the upgrade efficiency and enabling the daemon process to control the upgrade of the working process with the latest program instructions, thereby improving the stability of the upgrade process.
[0012] In one example, first determining whether to upgrade the program corresponding to the daemon process, and then determining whether to upgrade the program corresponding to the working process, includes:
[0013] Determining whether to upgrade the program corresponding to the daemon process of the client program;
[0014] If so, upgrading the program corresponding to the daemon process through the upgrade package, and determining whether to upgrade the program corresponding to the working process through the upgraded daemon process;
[0015] If not, the daemon process determines whether to upgrade the program corresponding to the working process.
[0016] The example of the present invention upgrades the working process through the daemon process, thereby indirectly realizing the upgrade control of the client program by the server.
[0017] In one example, the later determining whether to upgrade the program corresponding to the working process includes:
[0018] If it is determined to upgrade the program corresponding to the working process, the daemon process runs in an update mode to upgrade the program corresponding to the working process.
[0019] The embodiment of the present invention upgrades the working process by specially setting an update mode, thereby improving the accuracy of upgrading the working process.
[0020] In one example, if it is determined that the program corresponding to the working process is to be upgraded, the daemon process runs in an update mode to upgrade the program corresponding to the working process, and further includes:
[0021] The daemon process runs in a daemon mode to detect the running status of the working process, and restarts the working process when the working process runs abnormally.
[0022] The example of the present invention detects the working process that has just been updated through a daemon process, which can effectively solve the problem of a program failing just after the program is updated, thereby causing the system to crash.
[0023] In one example, if it is determined that the program corresponding to the working process is to be upgraded, the daemon process runs in an update mode to upgrade the program corresponding to the working process, and further includes:
[0024] Receive the query update request sent by the server, and feed back the client program update status and current version information to the server.
[0025] The example of the present invention feeds back the update status to the server so that the server knows the current update status, so that the server can decide whether to resend the upgrade instruction to the client program.
[0026] In one example, after receiving the client program upgrade task instruction sent by the server, the method further includes:
[0027] The task claiming thread of the client program stops claiming tasks from the task pool of the server and monitors the number of tasks being processed;
[0028] When the number of tasks returns to zero, the client program is upgraded.
[0029] The example of the present invention sends an upgrade instruction to the client program through a task claiming mechanism, so as to control the upgrade of the client program.
[0030] In one example, the upgrade package sent by the server upgrades the program corresponding to the working process of the client program and / or the program corresponding to the daemon process, including:
[0031] If the program corresponding to the working process of the client program and / or the program corresponding to the daemon process fails to be upgraded, the upgrade is performed again by executing a rollback or retry mechanism.
[0032] The example of the present invention can reduce the probability of update anomalies.
[0033] A second aspect of the present invention provides a device for automatically upgrading a client program, comprising: a processor and a memory connected to the processor in communication, wherein:
[0034] The memory stores instructions executable by the processor, and the instructions are executed by the processor to enable the processor to:
[0035] Receiving a client program upgrade task instruction sent by a server and an upgrade package corresponding to the upgrade task instruction;
[0036] The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process.
[0037] A third aspect of the present invention provides a non-volatile computer-readable storage medium for automatic client program upgrade, storing computer-executable instructions, wherein the computer-executable instructions are configured to:
[0038] Receiving a client program upgrade task instruction sent by a server and an upgrade package corresponding to the upgrade task instruction;
[0039] The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] 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:
[0041] Figure 1 A schematic diagram of a method flow chart provided by an embodiment of the present invention;
[0042] Figure 2 A timing diagram of a method provided by an embodiment of the present invention;
[0043] Figure 3 A schematic diagram of a device framework provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to more clearly illustrate the overall concept of the present application, a detailed description is given below in an illustrative manner in conjunction with the accompanying drawings.
[0045] The client in the scenario of the present invention is a client that does not log in frequently, and the server has a certain dependency on the version of the client program. Therefore, the upgrade of the server may generate the need to force the client to update, and many clients are not convenient to log in. The conventional client startup detection and manual update method do not meet the needs. The present invention adopts a task application processing mechanism in the physical client-server mode. When the server needs the client to update, it only needs to send the upgrade package and upgrade instructions to the client to complete the client update.
[0046] The embodiment of the present invention is the realization of the client-server mode under the limitation of unidirectional network connection, and the client is upgraded and restarted under the control of the server software under the relevant working conditions of the client executing the actual server. In order to adapt to this scenario and complete such technical tasks, it is required that not only the client software can be automatically upgraded under the control of the server, but also the client software can be restarted and run stably after the upgrade.
[0047] According to a first aspect of an embodiment of the present invention, the present invention provides a method for automatically upgrading a client program. Figure 1 The method flow diagram provided in the embodiment of the present invention includes:
[0048] S101 receives a client program upgrade task instruction sent by a server, and an upgrade package corresponding to the upgrade task instruction;
[0049] S102 upgrades the program corresponding to the working process of the client program and / or the program corresponding to the daemon process through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process.
[0050] From the perspective of structure, the embodiment of the present invention consists of two parts: server-side software and client-side program software, wherein the client-side program software mainly consists of two processes: a working process and a daemon process. The server side refers to software that is deployed in the cloud, on the server side of the network structure, and needs to work in client mode in the data flow direction. The client side refers to software that is deployed in the local network, on the client side of the network structure, and works in server mode in the data flow direction. The client and server hereinafter both refer to locations on the network structure. The working process refers to the program process that completes the main tasks of the client program software, and the daemon process refers to the program process that completes the upgrade of the working process and the daemon task, and the program packages required by the two processes are completely independent.
[0051] Figure 2 A timing diagram of the method provided by the embodiment of the present invention, such as Figure 2As shown, the daemon process, worker process, server and other main bodies perform the following steps to complete the controlled upgrade of the client program. The specific steps are as follows:
[0052] The client program registers with the server software. After the client is started, it registers the local information with the server, and the server records the client address. The client program starts the working process and the daemon process at the same time to ensure the stable operation of the client. After that, the client runs in a normal working state, such as applying for tasks from the server and executing and submitting task processing results.
[0053] The server pushes the upgrade package to the client program. When the server needs to upgrade the client program, it sends the upgrade package to the client program that needs to be upgraded through the task release and claim mechanism according to the recorded client information. The upgrade package can be transmitted in segments. The upgrade package contains two subdirectories, work and daemon. These two subdirectories store the update packages of the client working process and the client daemon process respectively. If no update is required, this directory will not be generated.
[0054] The server sends an upgrade instruction to the client program and waits for the client software update to complete. Specifically, the server sends the upgrade instruction to the client in the form of a task, and attaches the upgrade package name, upgrade package MD5 and other information to the instruction. After receiving the instruction, the client program verifies that the upgrade package exists and is complete, then decompresses the upgrade package, and then starts a new thread to execute the update instruction and reports the start of the update to the server. After that, the server periodically asks the client for the update result, such as waiting for the update to time out for 15 minutes.
[0055] The client program stops claiming new tasks and waits for the currently executing tasks to complete. The client program first notifies the task claiming thread to stop, then monitors the number of tasks being processed, and waits for the number of tasks to return to zero before proceeding to the next step.
[0056] According to a specific embodiment of the present invention, the client program first determines whether to upgrade the daemon process and then determines whether to upgrade the working process through the subdirectory files in the upgrade package. The specific implementation method may include the following steps:
[0057] The client program notifies the daemon process to stop and exit, and waits for the daemon process to exit. In some specific embodiments of the present invention, the client program notifies the daemon process to stop and exit through inter-process communication methods such as file sharing and memory sharing, and then monitors whether the daemon process exits through a process lock method.
[0058] The client program updates the program corresponding to the daemon process according to the upgrade package. After the client detects that the daemon process has exited, it uses the update package to update the program corresponding to the daemon process. It should be noted that if the client program detects that the upgrade package contains the daemon directory, it will upgrade the program corresponding to the daemon process, otherwise it will skip this step directly.
[0059] The client program starts the daemon process in update mode and causes the working process to exit automatically. Specifically, the client program starts the daemon process, adds the startup parameter -u to indicate that it is started in update mode, and adds information such as the update file directory. After starting the daemon process, the working process of the client program exits automatically.
[0060] The daemon updates the program corresponding to the working process according to the upgrade package. The daemon detects whether the upgrade package contains the work directory. If it does, it updates the client program according to the startup parameters. If it does not, it skips this step.
[0061] After the work process is updated, the new client program is first started in the upgraded startup mode, and the daemon process automatically enters the daemon mode, that is, it continuously detects the running status of the client, and restarts the client program when its status is abnormal.
[0062] After the updated client program is started, it submits the update result to the server software. The update result can be actively fed back to the server or passively fed back to the server, and the running status of its daemon process is monitored.
[0063] In some preferred embodiments of the present invention, in all the above steps, a rollback or retry mechanism for failed execution may be added to reduce the probability of update anomalies.
[0064] The embodiment of the present invention realizes that the client upgrade is completely controlled by the server software, and there is no need for the client-side personnel to participate in the update. It has high applicability in situations where the client location cannot be easily accessed by personnel or the server software depends on the client program update. At the same time, the client daemon process is added, the stability of the client program is greatly improved, and the problem of the server software task being unable to be executed due to the client downtime is greatly reduced.
[0065] Based on the same idea, some embodiments of the present invention also provide devices and non-volatile computer storage media corresponding to the above methods.
[0066] Figure 3 A schematic diagram of a device framework provided by an embodiment of the present invention, as shown in the figure, a device for automatically upgrading a client program includes: a processor and a memory connected to the processor in communication, wherein:
[0067] The memory stores instructions executable by the processor, and the instructions are executed by the processor to enable the processor to:
[0068] Receiving a client program upgrade task instruction sent by a server and an upgrade package corresponding to the upgrade task instruction;
[0069] The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process.
[0070] Some embodiments of the present invention also provide a non-volatile computer-readable storage medium for automatically upgrading a client program corresponding to the method, storing computer-executable instructions, wherein the computer-executable instructions are configured to:
[0071] Receiving a client program upgrade task instruction sent by a server and an upgrade package corresponding to the upgrade task instruction;
[0072] The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process.
[0073] Embodiments of the Invention The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0074] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the application.
Claims
1. A method for automatically upgrading a client program, characterized in that: include: Receiving a client program upgrade task instruction and an upgrade package corresponding to the upgrade task instruction sent by a server, wherein the client program upgrade task instruction and the upgrade package corresponding to the upgrade task instruction are sent by the server to the client program through a task release and claim mechanism according to client information recorded in the server; The program corresponding to the working process of the client program and / or the program corresponding to the daemon process is upgraded through the upgrade package sent by the server, wherein the daemon process is used to detect the running status of the working process and to upgrade the working process, and the daemon process is completely independent of the program package required by the working process; The upgrade package sent by the server upgrades the working process and / or daemon process of the client program, including: first determining whether to upgrade the program corresponding to the daemon process through the upgrade package, and then determining whether to upgrade the program corresponding to the working process; The method first determines whether to upgrade the program corresponding to the daemon process, and then determines whether to upgrade the program corresponding to the working process, including: determining whether to upgrade the program corresponding to the daemon process of the client program, and if so, upgrading the program corresponding to the daemon process through the upgrade package, and determining whether to upgrade the program corresponding to the working process through the upgraded daemon process, if not, determining whether to upgrade the program corresponding to the working process through the daemon process.
2. The method according to claim 1, characterized in that The step of determining whether to upgrade the program corresponding to the working process comprises: If it is determined to upgrade the program corresponding to the working process, the daemon process runs in an update mode to upgrade the program corresponding to the working process.
3. The method according to claim 2, characterized in that If it is determined that the program corresponding to the working process is to be upgraded, the daemon process runs in an update mode to upgrade the program corresponding to the working process, and further includes: The daemon process runs in a daemon mode to detect the running status of the working process, and restarts the working process when the working process runs abnormally.
4. The method according to claim 2, characterized in that: If it is determined that the program corresponding to the working process is to be upgraded, the daemon process runs in an update mode to upgrade the program corresponding to the working process, and further includes: Receive the query update request sent by the server, and feed back the client program update status and current version information to the server.
5. The method according to claim 1, characterized in that After receiving the client program upgrade task instruction sent by the server, the method further includes: The task claiming thread of the client program stops claiming tasks from the task pool of the server and monitors the number of tasks being processed; When the number of tasks returns to zero, the client program is upgraded.
6. The method according to claim 1, characterized in that The upgrade package sent by the server upgrades the program corresponding to the working process of the client program and / or the program corresponding to the daemon process, including: If the program corresponding to the working process of the client program and / or the program corresponding to the daemon process fails to be upgraded, the upgrade is performed again by executing a rollback or retry mechanism.
7. A device for automatically upgrading a client program, characterized in that: include: A processor and a memory communicatively connected to the processor, wherein: The memory stores instructions executable by the processor, and the instructions are executed by the processor so that the processor can execute the method for automatically upgrading a client program as described in any one of claims 1-6.
8. A non-volatile computer-readable storage medium for automatically upgrading a client program, storing computer-executable instructions, characterized in that: The computer executable instructions are configured to be capable of executing a method for automatically upgrading a client program as described in any one of claims 1 to 6.
