Disclosure of Invention
An object of the present application is to provide a process daemon method and device, so as to solve the problem of an accident or exit caused when an application of a recovered terminal is detected in the prior art, thereby implementing daemon on a detection process in a detection process, and further improving detection efficiency.
According to an aspect of the present application, there is provided a process daemon method, wherein the method comprises:
creating a daemon process;
starting the daemon process to detect whether at least one tested application program is in a running state,
if the at least one application program has a stopped target application program, determining the stopped target application program, and calling a starting interface of the target application program to restart the target application program.
Further, in the above process daemon method, the step of starting the daemon process to detect whether at least one application program is in a running state includes:
and starting the daemon process, and periodically detecting whether the tested at least one application program is in a running state.
Further, in the above process daemon method, the method further includes:
acquiring latest version information of the target application program from network equipment, wherein the network equipment is used for storing the latest version information of all the application programs;
comparing the latest version information of the target application program with local version information of the target application program;
if the local version information is consistent with the latest version information of the target application program, generating response information for indicating that the version of the target application program does not need to be updated.
Further, in the above process daemon method, the method further includes:
if the local version information is inconsistent with the latest version information of the target application program, requesting the version information content of the latest version of the target application program from the network equipment;
receiving a latest version of version information content of the target application from the network device;
and updating the target application program corresponding to the local version information based on the version information content of the latest version.
Further, in the above process daemon method, receiving a version information content of a latest version of the target application program from the network device includes:
and receiving the version information content of the latest version of the target application program from the network equipment in a breakpoint continuous transmission mode.
According to another aspect of the present application, there is also provided an apparatus for process daemon, wherein the apparatus comprises:
creating means for creating a daemon process;
a detection device for starting the daemon process to detect whether at least one application program is in a running state or not,
and the restarting application device is used for determining the stopped target application program and calling a starting interface of the target application program to restart the target application program if the stopped target application program exists in the at least one application program.
Further, in the above device for process daemon, the detecting means is configured to:
and starting the daemon process, and periodically detecting whether the tested at least one application program is in a running state.
Further, in the above device for process daemon, the device is further configured to:
acquiring latest version information of the target application program from network equipment, wherein the network equipment is used for storing the latest version information of all the application programs;
comparing the latest version information of the target application program with local version information of the target application program;
if the local version information is consistent with the latest version information of the target application program, generating response information for indicating that the version of the target application program does not need to be updated.
Further, in the above device for process daemon, the device is further configured to:
if the local version information is inconsistent with the latest version information of the target application program, requesting the version information content of the latest version of the target application program from the network equipment;
receiving a latest version of version information content of the target application from the network device;
and updating the target application program corresponding to the local version information based on the version information content of the latest version.
Further, in the above device for process daemon, the device is further configured to:
and receiving the version information content of the latest version of the target application program from the network equipment in a breakpoint continuous transmission mode.
According to another aspect of the present application, there is also provided a non-volatile storage medium having computer readable instructions stored thereon, which, when executed by a processor, cause the processor to implement the process daemon method as described above.
Compared with the prior art, the application establishes the daemon process; the daemon process is started to detect whether at least one application program tested is in a running state, if the at least one application program has a stopped target application program, the stopped target application program is determined, a starting interface of the target application program is called to restart the target application program, the fact that the at least one application program tested is detected through the daemon process is achieved, the starting interface of the target application program is directly called after the stopped target application program is detected, the target application program is restarted, stopping of the at least one application program tested possibly caused by accidents or quitting is avoided, accordingly, daemon of running processes corresponding to the application programs in the detection process is achieved, and detection efficiency is further improved.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
Fig. 1 is a flow chart illustrating a process daemon method according to an aspect of the present Application, applied in a process of detecting an Application program (APP) of a terminal, where the terminal includes but is not limited to a mobile terminal such as a smart phone, a computer, and an Ipad, and in a preferred embodiment of the present Application, the terminal is preferably a recycled mobile phone. The method comprises the following steps: step S11, step S12, step S13 and step S14, which specifically include the following steps:
step S11, a daemon process is established; the daemon process is used for detecting the running process of at least one application program to be tested, so that the specific stopped application program can be determined as soon as possible when an accident or exit condition occurs later, and the application program is tested and restarted.
Step S12, the daemon process is started to detect whether at least one tested application program is in a running state, where the application program is in the running state and is used to indicate that the application program is in a program testing process.
Step S13, if there is a target application program that is stopped in the at least one application program, determining the target application program that is stopped, and calling a start interface of the target application program to restart the target application program.
Step S14, if there is no stopped target application program in the at least one application program, determining that the at least one application program under test is operating normally.
Through the steps S11 to S14, the detection of the at least one tested application program by the daemon process is realized, and after the target application program that is stopped is detected, the start interface of the target application program is directly called to restart the target application program, so that the stop of the at least one tested application program caused by an accident or exit in the detection process is avoided, the daemon of the running process corresponding to each application program in the detection process is realized, and the detection efficiency is further improved.
For example, the step S11 creates a daemon P first; if there are 5 APPs to be tested in the cell phone, APP1, APP2, APP3, APP4 and APP5 respectively, in the case of 5 APPs in the cell phone: in the process of testing APP1, APP2, APP3, APP4, and APP5, the step S12 starts the created daemon process P to perform the following steps on the 5 tested APPs: APP1, APP2, APP3, APP4, and APP5 perform process daemon of the running state to detect the 5 APPs in the testing process: whether APP1, APP2, APP3, APP4 and APP5 are in an operating state; if the 5 APPs: APP4 of APP1, APP2, APP3, APP4 and APP5 is in a stopped state, and the stopped application is determined: APP4 is the target application to call APP 4's start interface restart APP4, realize the guard to the operation process that each application in the testing process corresponds, and after detecting out the APP4 that stops, directly call APP 4's start interface, restart APP4, thereby improve detection efficiency.
In this embodiment, the step S12 of starting the daemon process to detect whether at least one application program is in a running state specifically includes: and starting the daemon process, and periodically detecting whether the tested at least one application program is in a running state. For example, in order to save memory resources while performing process daemon for detecting whether all the tested applications are in a running state, step S12 starts a daemon P, and periodically detects the 5 tested APPs: APP1, APP2, APP3, APP4 and APP5 carry out whether all be in the running state, have avoided the occupation of the memory resource that real-time detection leads to, can also realize 5 APPs to the test through periodic detection: and effectively detecting whether the APP1, the APP2, the APP3, the APP4 and the APP5 are in the running state.
A process daemon method provided by another embodiment of the present application further includes:
acquiring latest version information of the target application program from network equipment, wherein the network equipment is used for storing the latest version information of all the application programs;
comparing the latest version information of the target application program with local version information of the target application program;
if the local version information is consistent with the latest version information of the target application program, generating response information for indicating that the version of the target application program does not need to be updated.
For example, the network device side stores the latest version information of all the applications, for example, the latest version information of APP1 is V1 ', the latest version information of APP2 is V2 ', the latest version information of APP3 is V3 ', the latest version information of APP4 is V4 ', and the latest version information of APP5 is V5 ', so that the network device can provide the latest version information when the terminal needs to query the latest version information of any one of all the applications. In an actual detection scenario, a target application is obtained from a network device: latest version information V4' of APP4, which is to be used by the target application: the latest version information V4' of APP4 with the target application: comparing the local version information V4 of the APP 4; if the target application program: local version information V4 of APP4 with the target application: the latest version information V4' of APP4 is consistent, and a flag indicating that the target application does not need to be updated is generated: response information of the version of APP4 to prompt the device for process daemon not to: APP4 makes version updates and the target application: the current version of APP4 is already the latest version, thus enabling: update detection of version information of APP 4.
In this embodiment, if the local version information is inconsistent with the latest version information of the target application program, requesting the network device for the version information content of the latest version of the target application program;
receiving a latest version of version information content of the target application from the network device;
and updating the target application program corresponding to the local version information based on the version information content of the latest version.
For example, in the case of a target application: the latest version information V4' of APP4 with the target application: after comparing the local version information V4 of the APP4, if the target application: local version information V4 of APP4 with the target application: if the latest version information V4' of the APP4 is inconsistent, the target application program is requested to the network equipment: version information content of the latest version V4' of APP 4; so that the network device can, based on the request,: the version information content of the latest version V4' of the APP4 is sent to the equipment for process daemon; causing the device for process daemon to receive a target application from the network device: after the version information content of the latest version V4 'of the APP4, and based on the version information content of the latest version V4', for the target application corresponding to the local version information V4: the APP4 is updated to get the latest version of the target application: APP4, implementing: when the version information of the APP4 is updated and detected, the following effects are achieved for the target application program: update of a version of APP 4.
In this embodiment, in order to prevent that all the version content information needs to be reacquired again after an interruption occurs in the process of acquiring the version information content of the latest version of the target application from the network device, the receiving the version information content of the latest version of the target application program from the network device specifically includes: and receiving the version information content of the latest version of the target application program from the network equipment in a breakpoint continuous transmission mode, so that after an interruption fault occurs in the process of acquiring/downloading the version information content of the latest version of the target application program, the acquired/downloaded content position when the interruption fault occurs can be determined, and in the process of recovering normal acquisition/downloading, the unfinished acquired/downloaded information content in the version information content of the latest version of the target application program is continuously acquired/downloaded from the acquired/downloaded content position when the interruption fault occurs, without acquiring/downloading the version information content of the latest version of the target application program from the beginning, thereby saving the time of version updating and improving the speed of version updating.
Fig. 2 is a schematic diagram illustrating a structure of a device for process daemon according to an aspect of the present Application, which is applied in a process of detecting an Application (APP) of a terminal, where the terminal includes but is not limited to a mobile terminal such as a smart phone, a computer, and an Ipad, and in a preferred embodiment of the present Application, the terminal is preferably a recycled mobile phone. The apparatus for process daemon includes: the creating device 11, the detecting device 12, the restarting application device 13 and the normaloperation determining device 14 specifically include the following steps:
creating means 11 for creating a daemon process; the daemon process is used for detecting the running process of at least one application program to be tested, so that the specific stopped application program can be determined as soon as possible when an accident or exit condition occurs later, and the application program is tested and restarted.
The detecting device 12 is configured to start the daemon to detect whether at least one application program under test is in a running state, where the application program in the running state is used to indicate that the application program is in a process of program testing.
And the restart application device 13 is configured to determine a stopped target application program if the stopped target application program exists in the at least one application program, and call a start interface of the target application program to restart the target application program.
Normaloperation determining means 14, configured to determine that the at least one tested application operates normally if there is no stopped target application in the at least one application.
Through the creating device 11, the detecting device 12, the restarting application device 13 and the normaloperation determining device 14, the detection of the tested at least one application program through the daemon process is realized, and after the stopped target application program is detected, the starting interface of the target application program is directly called to restart the target application program, so that the stop of the tested at least one application program caused by accidents or quitting possibly in the detection process is avoided, the daemon of the running process corresponding to each application program in the detection process is realized, and the detection efficiency is further improved.
For example, the creating means 11 first creates a daemon P; if there are 5 APPs to be tested in the cell phone, APP1, APP2, APP3, APP4 and APP5 respectively, in the case of 5 APPs in the cell phone: in the process of testing APP1, APP2, APP3, APP4, and APP5, the detection apparatus 12 starts the created daemon process P to perform the following operations on the 5 tested APPs: APP1, APP2, APP3, APP4, and APP5 perform process daemon of the running state to detect the 5 APPs in the testing process: whether APP1, APP2, APP3, APP4 and APP5 are in an operating state; if the 5 APPs: APP4 of APP1, APP2, APP3, APP4 and APP5 is in a stopped state, and the stopped application is determined: APP4 is the target application to call APP 4's start interface restart APP4, realize the guard to the operation process that each application in the testing process corresponds, and after detecting out the APP4 that stops, directly call APP 4's start interface, restart APP4, thereby improve detection efficiency.
In this embodiment, the detecting device 12 is specifically configured to: and starting the daemon process, and periodically detecting whether the tested at least one application program is in a running state. For example, in order to save memory resources while performing process daemon on at least one application program under test for detecting whether the application program is in a running state, the detection device 12 starts a daemon process P, periodically detects the 5 APPs under test: APP1, APP2, APP3, APP4 and APP5 carry out whether all be in the running state, have avoided the occupation of the memory resource that real-time detection leads to, can also realize 5 APPs to the test through periodic detection: and effectively detecting whether the APP1, the APP2, the APP3, the APP4 and the APP5 are in the running state.
Another embodiment of the present application provides an apparatus for process daemon, further comprising:
acquiring latest version information of the target application program from network equipment, wherein the network equipment is used for storing the latest version information of all the application programs;
comparing the latest version information of the target application program with local version information of the target application program;
if the local version information is consistent with the latest version information of the target application program, generating response information for indicating that the version of the target application program does not need to be updated.
For example, the network device side stores the latest version information of all the applications, for example, the latest version information of APP1 is V1 ', the latest version information of APP2 is V2 ', the latest version information of APP3 is V3 ', the latest version information of APP4 is V4 ', and the latest version information of APP5 is V5 ', so that the network device can provide the latest version information when the terminal needs to query the latest version information of any one of all the applications. In an actual detection scenario, a target application is obtained from a network device: latest version information V4' of APP4, which is to be used by the target application: the latest version information V4' of APP4 with the target application: comparing the local version information V4 of the APP 4; if the target application program: local version information V4 of APP4 with the target application: the latest version information V4' of APP4 is consistent, and a flag indicating that the target application does not need to be updated is generated: response information of the version of APP4 to prompt the device for process daemon not to: APP4 makes version updates and the target application: the current version of APP4 is already the latest version, thus enabling: update detection of version information of APP 4.
In this embodiment, if the local version information is inconsistent with the latest version information of the target application program, requesting the network device for the version information content of the latest version of the target application program;
receiving a latest version of version information content of the target application from the network device;
and updating the target application program corresponding to the local version information based on the version information content of the latest version.
For example, in the case of a target application: the latest version information V4' of APP4 with the target application: after comparing the local version information V4 of the APP4, if the target application: local version information V4 of APP4 with the target application: if the latest version information V4' of the APP4 is inconsistent, the target application program is requested to the network equipment: version information content of the latest version V4' of APP 4; so that the network device can, based on the request,: the version information content of the latest version V4' of the APP4 is sent to the equipment for process daemon; causing the device for process daemon to receive a target application from the network device: after the version information content of the latest version V4 'of the APP4, and based on the version information content of the latest version V4', for the target application corresponding to the local version information V4: the APP4 is updated to get the latest version of the target application: APP4, implementing: when the version information of the APP4 is updated and detected, the following effects are achieved for the target application program: update of a version of APP 4.
In this embodiment, in order to prevent that all the version content information needs to be reacquired again after an interruption occurs in the process of acquiring the version information content of the latest version of the target application from the network device, the receiving the version information content of the latest version of the target application program from the network device specifically includes: and receiving the version information content of the latest version of the target application program from the network equipment in a breakpoint continuous transmission mode, so that after an interruption fault occurs in the process of acquiring/downloading the version information content of the latest version of the target application program, the acquired/downloaded content position when the interruption fault occurs can be determined, and in the process of recovering normal acquisition/downloading, the unfinished acquired/downloaded information content in the version information content of the latest version of the target application program is continuously acquired/downloaded from the acquired/downloaded content position when the interruption fault occurs, without acquiring/downloading the version information content of the latest version of the target application program from the beginning, thereby saving the time of version updating and improving the speed of version updating.
According to another aspect of the present application, there is also provided a non-volatile storage medium having computer readable instructions stored thereon, which, when executed by a processor, cause the processor to implement the process daemon method as described above.
In summary, the application establishes a daemon process; the daemon process is started to detect whether at least one application program tested is in a running state, if the at least one application program has a stopped target application program, the stopped target application program is determined, a starting interface of the target application program is called to restart the target application program, the fact that the at least one application program tested is detected through the daemon process is achieved, the starting interface of the target application program is directly called after the stopped target application program is detected, the target application program is restarted, stopping of the at least one application program tested possibly caused by accidents or quitting is avoided, accordingly, daemon of running processes corresponding to the application programs in the detection process is achieved, and detection efficiency is further improved.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.