CN106371927A - Linux daemon process realization method and system - Google Patents

Linux daemon process realization method and system Download PDF

Info

Publication number
CN106371927A
CN106371927A CN201610816533.6A CN201610816533A CN106371927A CN 106371927 A CN106371927 A CN 106371927A CN 201610816533 A CN201610816533 A CN 201610816533A CN 106371927 A CN106371927 A CN 106371927A
Authority
CN
China
Prior art keywords
finger daemon
caching
pid
run
daemon
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610816533.6A
Other languages
Chinese (zh)
Inventor
曹黎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Skyworth Digital Technology Co Ltd
Shenzhen Skyworth Software Co Ltd
Original Assignee
Shenzhen Skyworth Digital Technology Co Ltd
Shenzhen Skyworth Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Skyworth Digital Technology Co Ltd, Shenzhen Skyworth Software Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN201610816533.6A priority Critical patent/CN106371927A/en
Publication of CN106371927A publication Critical patent/CN106371927A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a Linux daemon process realization method and system. The method comprises the following steps of starting a daemon receiving process; judging whether the daemon receiving process runs or not; if the daemon receiving process does not run, obtaining all process information of port number occupied when the daemon receiving process runs; closing threads included in the all process information; returning to the step of executing the starting of the daemon receiving process. When the daemon receiving process does not run, all threads of the port number occupied when the daemon receiving process runs are closed, so that the daemon receiving process can be automatically re-started; the manual closing of all processes by a user and the manual starting of the daemon receiving process by the user are not needed; the workload of responsible persons in charge of maintaining the automatic building system is greatly reduced; the qualitative leap experience is brought to the responsible persons of the automatic building system; convenience is also brought to the use by the user.

Description

A kind of realization method and system of linux finger daemon
Technical field
The present invention relates to linux technical field, more particularly, to a kind of realization method and system of linux finger daemon.
Background technology
Linux is a set of free class unix operating system using with Free propagation, is one based on posix and unix Multi-user, the operating system of multitask, support multithreading and many cpu, it can run main unix tool software, application program And procotol.Linux inherits the design philosophy with network as core for the unix, is the multiple-user network behaviour of a stable performance Make system.In linux or unix operating system, finger daemon (daemon) is a kind of special processing operating in backstage, It independent of control terminal and periodically executes certain task or waits pending some events.Finger daemon is the heaviest The characteristic wanted is running background;Secondly finger daemon must with its run before be environmentally isolated and come, these environment include not closing The filec descriptor closing, control terminal, session and process group, working directory and document creation pattern etc..
Automatic build system is cs framework at present, once being collapsed by finger daemon or having gone out exception, the use of structure automatically Family just cannot from client using the normal function of automatic build system it is therefore necessary to ensure that the finger daemon moment will be deposited And normal work.Current finger daemon major part is all c Programming with Pascal Language, and the finger daemon of c speech encoding cannot do To restarting by finger daemon every time, because being received every time after the information of client by finger daemon, all may call Shell script is compiled or builds, and some shell scripts can play a lot of threads, once entering ARIXTRA compiling, a large amount of threads Can produce, these threads all can take port numbers, be certain to failure if simply turning off and server being restarted again by finger daemon, because The thread producing for these shell scripts is still running, and takies port numbers, so for the quilt taking port numbers For finger daemon, once being hung by finger daemon, can only be just all relation lines taking this port numbers of user's manual-lock Journey, and manually boot by finger daemon it is impossible to automatically restart by finger daemon, bring very many workloads to user.
Content of the invention
The invention provides a kind of realization method and system of linux finger daemon, by by finger daemon off-duty When, close all processes of the port numbers taking when being run by finger daemon, enable to be resetted automatically by finger daemon, greatly Decrease greatly the workload being responsible for the director safeguarding automatic build system, also brought convenience using user.
For realizing above-mentioned design, the present invention employs the following technical solutions:
On the one hand, there is provided a kind of implementation method of linux finger daemon, the method, comprising:
Start by finger daemon;
Judge described whether to be run by finger daemon;
If described by finger daemon off-duty, obtain all of the described port numbers taking when being run by finger daemon Progress information;
Close the thread comprising in described all progress informations, return the described startup of execution by the step of finger daemon.
Wherein, described finger daemon is formed with shell Scripting Edition.
Wherein, the thread comprising in the described all progress informations of described closing, comprising:
Described all progress informations are stored in the first caching;
Filter out No. pid of the described all progress informations in described first caching, described No. pid separated with space, After separating No. pid is stored in the second caching;N is the quantity of No. pid;
Obtain each No. pid in described second caching, each No. pid be sequentially stored into caching 1, caching 2 ..., slow Deposit in n;
Successively close caching 1, caching 2 ..., caching the corresponding thread of n.
Wherein:
Described judge described whether run by finger daemon, particularly as follows: by described in ps command determination by finger daemon Whether run;
The described all progress informations obtaining the described port numbers taking when being run by finger daemon, particularly as follows: pass through Netsat order obtains all progress informations of the described port numbers taking when being run by finger daemon;
Described filter out the described all progress informations in described first caching No. pid, particularly as follows: by awk order Filter out No. pid of the described all progress informations in described first caching;
Described each No. pid obtaining in described second caching, particularly as follows: being separated by space with regular expression and obtaining Take each No. pid in described second caching;
Described successively close caching 1, caching 2 ..., caching the corresponding thread of n, particularly as follows: being closed successively with kill order Close caching 1, caching 2 ..., caching the corresponding thread of n.
Wherein:
Described start by before finger daemon, also include:
Using the end in/etc/rc.local add a line in the way of the row that absolute path starts finger daemon Start finger daemon after Linux system start;
Described startup is by finger daemon, particularly as follows: being started by finger daemon using finger daemon.
Wherein, described judge described whether run by finger daemon after, also include:
If being run by finger daemon, dormancy preset time, afterwards return execution described judge described by finger daemon Whether operating procedure.
On the other hand, there is provided a kind of linux finger daemon realize system, this system, comprising:
By finger daemon starting module, for starting by finger daemon;
Whether judge module, for judging described to be run by finger daemon;
Data obtaining module, if for judge module judge described by finger daemon off-duty, obtain described being kept All progress informations of the port numbers that shield process takies when running;
Closedown module, for closing the thread comprising in described all progress informations.
Wherein, described finger daemon is formed with shell Scripting Edition.
Wherein, described closedown module, comprising:
First buffer unit, for being stored in the first caching by described all progress informations;
Second buffer unit, for filtering out No. pid of described all progress informations in described first caching, will be described No. pid is separated with space, and No. pid after separating is stored in the second caching;
3rd buffer unit, for obtaining each No. pid in described second caching, is sequentially stored into slow each No. pid Deposit 1, caching 2 ..., in caching n;N is the quantity of No. pid;
Closing unit, for close successively caching 1, caching 2 ..., caching the corresponding thread of n;
Described system also includes:
Starting module, starts finger daemon for adding a line using the end in/etc/rc.local with absolute path Row mode Linux system start after start finger daemon.
Wherein, also include:
Sleep block, if judge to be run by finger daemon for judge module, dormancy preset time.
Compared with prior art, the invention has the benefit that starting by finger daemon;Judge described by finger daemon be No run;If described by finger daemon off-duty, obtain the institute of the described port numbers taking when being run by finger daemon There is progress information;Close the thread comprising in described all progress informations, return the described startup of execution by finger daemon.The present invention By, when by finger daemon off-duty, closing all threads of the port numbers taking when being run by finger daemon, making to be kept Shield process can reset automatically, and without processes all described in user's manual-lock and manually boot by finger daemon, significantly subtracts Lack the workload of the responsible director safeguarding automatic build system, bring flying of matter to the director of automatic build system The experience of jump, is also brought convenience using user.
Brief description
For the technical scheme being illustrated more clearly that in the embodiment of the present invention, below will be to institute in embodiment of the present invention description Need use accompanying drawing be briefly described it should be apparent that, drawings in the following description be only the present invention some enforcement Example, for those of ordinary skill in the art, on the premise of not paying creative work, can also be implemented according to the present invention The content of example and these accompanying drawings obtain other accompanying drawings.
Fig. 1 is a kind of the first enforcement of the implementation method of linux finger daemon providing in the specific embodiment of the invention The method flow diagram of example.
Fig. 2 is a kind of the second enforcement of the implementation method of linux finger daemon providing in the specific embodiment of the invention The method flow diagram of example.
Fig. 3 is a kind of first enforcement realizing system of the linux finger daemon providing in the specific embodiment of the invention The block diagram of example.
Fig. 4 is a kind of second enforcement realizing system of the linux finger daemon providing in the specific embodiment of the invention The block diagram of example.
Specific embodiment
For make present invention solves the technical problem that, the technical scheme that adopts and the technique effect that reaches clearer, below By combine accompanying drawing the technical scheme of the embodiment of the present invention is described in further detail it is clear that described embodiment only It is a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those skilled in the art exist The every other embodiment being obtained under the premise of not making creative work, broadly falls into the scope of protection of the invention.
Refer to Fig. 1, it is a kind of implementation method of the linux finger daemon providing in the specific embodiment of the invention The method flow diagram of first embodiment.The execution theme of the present embodiment is finger daemon, as illustrated, the method, comprising:
Step s101: start by finger daemon.
Finger daemon starts by finger daemon, and described can be any process by finger daemon, and finger daemon is with shell foot This editor forms.
Step s102: judge described whether to be run by finger daemon.If described by finger daemon off-duty, execute step Rapid s103;If described run by finger daemon, execution step s105.
Finger daemon starts by after finger daemon, if occurring not actuated by finger daemon, or after being started by finger daemon Occur collapse or occur abnormal it is impossible to situation about running, then need to judge described whether to be run by finger daemon.As one Preferred embodiment, described judged described whether operation by finger daemon, particularly as follows: judging described being kept by during cycle Whether whether shield process is run, be periodically detected to be guarded and often run, can moment normal work by finger daemon with guarantee Make.
Step s103: obtain all progress informations of the described port numbers taking when being run by finger daemon.
After step s102, if described illustrated exception by finger daemon by finger daemon off-duty, then obtain described All progress informations of the port numbers taking when being run by finger daemon, with according to obtain all progress informations to therein Thread is processed.
Step s104: close the thread comprising in described all progress informations, return execution step s101.
After obtaining the described all progress informations of port numbers taking when being run by finger daemon, described all enter The thread comprising in journey information is closed, and makes the thread of occupancy port numbers out of service, to restart by finger daemon.Close So that it may return execution step s101 after closing the thread comprising in described all progress informations: start by finger daemon.
Step s105: dormancy preset time, return execution step s102 afterwards.
After step s102, if described run by finger daemon, illustrate by finger daemon in normal work, then guard into Whether journey dormancy preset time, can reach and detect by the purpose of finger daemon operation, can reduce system power dissipation again.Guard into After journey dormancy preset time, return execution step s102: judge described whether run by finger daemon, formation one follow Ring, also corresponds to be periodically to judge described whether to be run by finger daemon.Described preset time be 1s, 3s, 5s and 7s it is preferable that described preset time be 5s, user also dependent on practical situation need other preset times are set.
In sum, the present embodiment passes through, when by finger daemon off-duty, to close and take when being run by finger daemon Port numbers all threads, enable to be resetted automatically by finger daemon, without processes all described in user's manual-lock simultaneously Manually boot by finger daemon, greatly reduce the workload being responsible for the director safeguarding automatic build system, build to automatic The director of system brings the experience of qualitative leap, is also brought convenience using user.
Refer to Fig. 2, it is a kind of implementation method of the linux finger daemon providing in the specific embodiment of the invention The method flow diagram of second embodiment.As illustrated, the method, comprising:
Step s201: add the row that a line starts finger daemon with absolute path using the end in/etc/rc.local Mode Linux system start after start finger daemon.
Finger daemon is formed with shell Scripting Edition, shell script, that is, under shell script, with windows/dos Batch processing similar, that is, be placed in advance in in a file with all kinds of orders, a program literary composition of convenient disposable execution Part, mainly facilitates the manager to be configured or manages.But it is more powerful than the batch processing under windows, than with The program efficiency of other programs editor is higher, and it employs the order under linux/unix after all.Also it is said differently It is that shell script is the program write using the function of shell, and this program is to use text-only file, by some The grammer of shell and instruction write on the inside, the function such as then use normal representation method, pipeline order and data flow to be redirected, with Reach the processing intent that we are wanted.For more expressly, shell script is just as the .bat in age early stage dos, simplest Function is exactly write whole for many instruction remittances together, allows user easily just an operation can execute multiple orders, and Shell script more there is provided array, circulation, the critical function such as condition and logical judgment, allow user can directly with Shell, to write a program, is similar to, without using, the grammer that the traditional programs such as c program language are write.
Start finger daemon, we can add a line with exhausted at the end of/etc/rc.local after Linux system start To path start script (i.e. the row of finger daemon a) because Linux system Starting mode and execution order are:
A, loading kernel;
B, execution init program;
First script that c ,/etc/rc.d/rc.sysinit# are executed by init;
D ,/etc/rc.d/rc $ runlevel# $ runlevel are default operational mode;
After e ,/etc/rc.d/rc.local# appropriate level service start, execute this document again, in fact can also be need Order to be executed is write in this document, such as our finger daemon a;
F ,/sbin/mingetty# wait User logs in.
Step s202: start by finger daemon.
Described startup is by finger daemon, particularly as follows: being started by finger daemon using finger daemon.By finger daemon can be Arbitrarily process.
Step s203: judge described whether to be run by finger daemon.If described by finger daemon off-duty, execute step Rapid s204;If described run by finger daemon, execution step s206.
Finger daemon starts by after finger daemon, if occurring not actuated by finger daemon, or after being started by finger daemon Occur collapse or occur abnormal it is impossible to situation about running, then need to judge described whether to be run by finger daemon.Described judgement Described whether run by finger daemon, particularly as follows: by whether being run by finger daemon described in ps command determination, Yong Huye Can order and to judge described whether to be run by finger daemon using there are other of identical function with ps order.Excellent as one The embodiment of choosing, described is judged described whether operation by finger daemon, particularly as follows: press during cycle by ps command determination Described whether run by finger daemon, whether moment detection is guarded and is often run, with guarantee by the finger daemon energy moment Normal work.
Step s204: obtain all progress informations of the described port numbers taking when being run by finger daemon.
After step s203, if described illustrated exception by finger daemon by finger daemon off-duty, then obtain described All progress informations of the port numbers taking when being run by finger daemon, with according to obtain all progress informations to therein Thread is processed.The described all progress informations obtaining the described port numbers taking when being run by finger daemon, particularly as follows: All progress informations of the port numbers taking when being run by finger daemon by netsat order acquisition is described.User also can profit With with netsat order have identical function other order to obtain described run by finger daemon when the port numbers that take All progress informations.If the port numbers not taken when being run by finger daemon, it is defaulted as 8888.
Step s205: close the thread comprising in described all progress informations, return execution step s202.
Step s205 includes step s2051~s2054, specific as follows:
Step s2051: described all progress informations are stored in the first caching.
Step s2052: filter out No. pid of described all progress informations in described first caching, by described No. pid with Space separates, and No. pid after separating is stored in the second caching.
Described filter out the described all progress informations in described first caching No. pid, particularly as follows: by awk order Filter out No. pid of the described all progress informations in described first caching.
Step s2053: obtain each No. pid in described second caching, be sequentially stored into caching 1, caching each No. pid 2nd ..., in caching n.Wherein, n is the quantity of No. pid.
Described each No. pid obtaining in described second caching, particularly as follows: being separated by space with regular expression and obtaining Take each No. pid in described second caching.
Step s2054: successively close caching 1, caching 2 ..., caching the corresponding thread of n.
Described successively close caching 1, caching 2 ..., caching the corresponding thread of n, particularly as follows: being closed successively with kill order Close caching 1, caching 2 ..., caching the corresponding thread of n.
After obtaining the described all progress informations of port numbers taking when being run by finger daemon, described all enter The thread comprising in journey information is closed, and makes the thread of occupancy port numbers out of service, to restart by finger daemon, because It is after finger daemon detects and do not run by finger daemon, only the end taking when taking and being run by finger daemon All threads of slogan close, and finger daemon just can successfully start up by finger daemon.Close bag in described all progress informations So that it may return execution step s202 after the thread containing: start by finger daemon.
Step s206: dormancy preset time, return execution step s203 afterwards.
After step s203, if described run by finger daemon, illustrate by finger daemon in normal work, then guard into Whether journey dormancy preset time, can reach and detect by the purpose of finger daemon operation, can reduce system power dissipation again.Guard into After journey dormancy preset time, return execution step s203: judge described whether run by finger daemon, formation one follow Ring, also corresponds to be periodically to judge described whether to be run by finger daemon.Described preset time be 1s, 3s, 5s and 7s it is preferable that described preset time be 5s, user also dependent on practical situation need other preset times are set.
The present embodiment adds, using the end in/etc/rc.local, the row that a line starts finger daemon with absolute path Mode starts finger daemon after Linux system start, finger daemon start after finger daemon, judged described guarded into Whether journey is run, if by finger daemon off-duty, closing all processes of the port numbers taking when being run by finger daemon, Enable to be resetted automatically by finger daemon;If being run by finger daemon, dormancy preset time, return afterwards and continue to judge Described whether run by finger daemon, can be periodically detected by finger daemon whether normal work, the present embodiment is being guarded Process occur collapse or abnormal when, without processes all described in user's manual-lock and manually boot by finger daemon, significantly subtract Lack the workload of the responsible director safeguarding automatic build system, bring flying of matter to the director of automatic build system The experience of jump, is also brought convenience using user.
A kind of embodiment realizing system of the linux finger daemon providing in the specific embodiment of the invention is provided, The embodiment realizing the embodiment of the system implementation method based on above-mentioned linux finger daemon of linux finger daemon is realized, Realize not most description in system in linux finger daemon, refer to the enforcement of the implementation method of aforementioned linux finger daemon Example.
Refer to Fig. 3, its be in the specific embodiment of the invention provide a kind of linux finger daemon realize system The block diagram of first embodiment.As illustrated, this system, comprising:
By finger daemon starting module 31, for starting by finger daemon.
Finger daemon starts by finger daemon, and described can be any process by finger daemon, and finger daemon is with shell foot This editor forms.
Whether judge module 32, for judging described to be run by finger daemon.
As one preferred embodiment, described judge module 32 specifically for: judge described being kept by during cycle Whether whether shield process is run, be periodically detected to be guarded and often run, can moment normal work by finger daemon with guarantee Make.
Data obtaining module 33, if for judge module 32 judge described by finger daemon off-duty, obtain described All progress informations of the port numbers taking when being run by finger daemon.
Closedown module 34, for closing the thread comprising in described all progress informations.
After closedown module 34 closes the thread comprising in described all progress informations, by finger daemon starting module 31 just Can restart by finger daemon.
Sleep block 35, if judge to be run by finger daemon for judge module 32, dormancy preset time.
After sleep block 35 dormancy preset time, judge module 32 continues to judge described whether to be transported by finger daemon OK., for 1s, 3s, 5s and 7s it is preferable that described preset time is 5s, user is also dependent on practical situation for described preset time Need to arrange other preset times.
In sum, the present embodiment passes through, when by finger daemon off-duty, to close and take when being run by finger daemon Port numbers all threads, enable to be resetted automatically by finger daemon, without processes all described in user's manual-lock simultaneously Manually boot by finger daemon, greatly reduce the workload being responsible for the director safeguarding automatic build system, build to automatic The director of system brings the experience of qualitative leap, is also brought convenience using user.
Refer to Fig. 4, its be in the specific embodiment of the invention provide a kind of linux finger daemon realize system The block diagram of second embodiment.As illustrated, this system, comprising:
Starting module 41, for using the end in/etc/rc.local add a line started with absolute path guard into The mode of the row of journey starts finger daemon after Linux system start.
By finger daemon starting module 42, for starting by finger daemon.
Whether judge module 43, for judging described to be run by finger daemon.
Described judge module 43 specifically for: by whether being run by finger daemon described in ps command determination.
Data obtaining module 44, if for judge module 43 judge described by finger daemon off-duty, obtain described All progress informations of the port numbers taking when being run by finger daemon.
The described all progress informations obtaining the described port numbers taking when being run by finger daemon, particularly as follows: pass through Netsat order obtains all progress informations of the described port numbers taking when being run by finger daemon.
Closedown module 45, for closing the thread comprising in described all progress informations.
First buffer unit 451, for being stored in the first caching by described all progress informations.
Second buffer unit 452, for filtering out No. pid of described all progress informations in described first caching, will Described No. pid is separated with space, and No. pid after separating is stored in the second caching.
Described filter out the described all progress informations in described first caching No. pid, particularly as follows: by awk order Filter out No. pid of the described all progress informations in described first caching.
3rd buffer unit 453, for obtaining each No. pid in described second caching, is sequentially stored into each No. pid Caching 1, caching 2 ..., caching n in.
Described each No. pid obtaining in described second caching, particularly as follows: being separated by space with regular expression and obtaining Take each No. pid in described second caching.
Closing unit 454, for close successively caching 1, caching 2 ..., caching the corresponding thread of n.
Closing unit 454 specifically for: with kill order close successively caching 1, caching 2 ..., caching the corresponding line of n Journey.
After obtaining the described all progress informations of port numbers taking when being run by finger daemon, described all enter The thread comprising in journey information is closed, and makes the thread of occupancy port numbers out of service, to restart by finger daemon, because It is after finger daemon detects and do not run by finger daemon, only the end taking when taking and being run by finger daemon All threads of slogan close, and finger daemon just can successfully start up by finger daemon.Closedown module 45 close described all enter After the thread comprising in journey information, just can be restarted by finger daemon by finger daemon starting module 42.
Sleep block 46, if judge to be run by finger daemon for judge module 43, dormancy preset time.
After sleep block 46 dormancy preset time, judge module 43 continues to judge described whether to be transported by finger daemon OK., for 1s, 3s, 5s and 7s it is preferable that described preset time is 5s, user is also dependent on practical situation for described preset time Need to arrange other preset times.
In sum, the present embodiment provides realizing system and being periodically detected and by finger daemon be of linux finger daemon No normal work, and when by finger daemon off-duty, all of the port numbers taking when being run by finger daemon can be closed Thread, enables to be resetted automatically by finger daemon, without processes all described in user's manual-lock and manually boot and guarded Process, greatly reduces the workload being responsible for the director safeguarding automatic build system, carries to the director of automatic build system Carry out the experience having qualitative leap, also brought convenience using user.
Describe the know-why of the present invention above in association with specific embodiment.These descriptions are intended merely to explain the present invention's Principle, and limiting the scope of the invention can not be construed to by any way.Based on explanation herein, the technology of this area Personnel do not need to pay other specific embodiments that performing creative labour can associate the present invention, and these modes fall within Within protection scope of the present invention.

Claims (10)

1. a kind of implementation method of linux finger daemon is it is characterised in that include:
Start by finger daemon;
Judge described whether to be run by finger daemon;
If described by finger daemon off-duty, obtain all processes of the described port numbers taking when being run by finger daemon Information;
Close the thread comprising in described all progress informations, return the described startup of execution by the step of finger daemon.
2. method according to claim 1 is it is characterised in that described finger daemon is formed with shell Scripting Edition.
3. method according to claim 2 is it is characterised in that the line that comprises in the described all progress informations of described closing Journey, comprising:
Described all progress informations are stored in the first caching;
Filter out No. pid of described all progress informations in described first caching, described No. pid separated with space, every No. pid after opening is stored in the second caching;
Obtain described second caching in each No. pid, No. pid be sequentially stored into caching 1, caching 2 ..., cache n in;N is The quantity of No. pid;
Successively close caching 1, caching 2 ..., caching the corresponding thread of n.
4. method according to claim 3 it is characterised in that:
Described judge described whether run by finger daemon, particularly as follows: by described in ps command determination by finger daemon whether Run;
The described all progress informations obtaining the described port numbers taking when being run by finger daemon, particularly as follows: pass through Netsat order obtains all progress informations of the described port numbers taking when being run by finger daemon;
Described filter out the described all progress informations in described first caching No. pid, particularly as follows: filtered by awk order Go out No. pid of the described all progress informations in described first caching;
Described each No. pid obtaining in described second caching, particularly as follows: being separated by space with regular expression and obtaining institute State each No. pid in the second caching;
Described successively close caching 1, caching 2 ..., caching the corresponding thread of n, particularly as follows: with kill order successively close delay Deposit 1, caching 2 ..., the caching corresponding thread of n.
5. method according to claim 2 it is characterised in that:
Described start by before finger daemon, also include:
Add a line using the end in/etc/rc.local in the way of the row that absolute path starts finger daemon in linux Start finger daemon after system boot;
Described startup is by finger daemon, particularly as follows: being started by finger daemon using finger daemon.
6. method according to claim 1 is it is characterised in that described judge described whether to have been run it by finger daemon Afterwards, also include:
If being run by finger daemon, dormancy preset time, return afterwards execution described judge described by finger daemon whether The step of operation.
7. a kind of linux finger daemon realize system it is characterised in that include:
By finger daemon starting module, for starting by finger daemon;
Whether judge module, for judging described to be run by finger daemon;
Data obtaining module, if for judge module judge described by finger daemon off-duty, obtain described guarded into All progress informations of the port numbers taking when journey is run;
Closedown module, for closing the thread comprising in described all progress informations.
8. system according to claim 7 is it is characterised in that described finger daemon is formed with shell Scripting Edition.
9. system according to claim 8 it is characterised in that:
Described closedown module, comprising:
First buffer unit, for being stored in the first caching by described all progress informations;
Second buffer unit, for filtering out No. pid of described all progress informations in described first caching, by described pid Number separated with space, No. pid after separating is stored in the second caching;
3rd buffer unit, for obtain described second caching in each No. pid, each No. pid be sequentially stored into caching 1, Caching 2 ..., caching n in;N is the quantity of No. pid;
Closing unit, for close successively caching 1, caching 2 ..., caching the corresponding thread of n;
Described system also includes:
Starting module, for adding, using the end in/etc/rc.local, the row that a line starts finger daemon with absolute path Mode Linux system start after start finger daemon.
10. system according to claim 7 is it is characterised in that also include:
Sleep block, if judge to be run by finger daemon for judge module, dormancy preset time.
CN201610816533.6A 2016-09-09 2016-09-09 Linux daemon process realization method and system Pending CN106371927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610816533.6A CN106371927A (en) 2016-09-09 2016-09-09 Linux daemon process realization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610816533.6A CN106371927A (en) 2016-09-09 2016-09-09 Linux daemon process realization method and system

Publications (1)

Publication Number Publication Date
CN106371927A true CN106371927A (en) 2017-02-01

Family

ID=57899579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610816533.6A Pending CN106371927A (en) 2016-09-09 2016-09-09 Linux daemon process realization method and system

Country Status (1)

Country Link
CN (1) CN106371927A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107402814A (en) * 2017-07-07 2017-11-28 上海斐讯数据通信技术有限公司 A kind of method and system for saving internal memory in embedded systems
CN108595273A (en) * 2018-05-10 2018-09-28 北京世纪东方通讯设备有限公司 A kind of Console program guard method and system
CN109426591A (en) * 2017-09-04 2019-03-05 武汉斗鱼网络科技有限公司 Guard the method and apparatus of multiple processes of the single program of windows
CN109558257A (en) * 2017-09-26 2019-04-02 南京南瑞继保电气有限公司 A kind of application process guard method based on order line
CN109815110A (en) * 2018-12-11 2019-05-28 北京城市网邻信息技术有限公司 A kind of network port management method, device, terminal device and storage medium
CN114791835A (en) * 2022-03-16 2022-07-26 青岛海尔科技有限公司 Program restarting method and device, storage medium and electronic device
CN116055285A (en) * 2023-03-27 2023-05-02 西安热工研究院有限公司 Process management method and system of industrial control system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1904852A (en) * 2006-08-01 2007-01-31 西安西电捷通无线网络通信有限公司 Method for monitoring and abnormal processing of computer application program
CN102331950A (en) * 2011-09-15 2012-01-25 北京安天电子设备有限公司 Method and system for realizing daemon process based on Linux timing task
CN103034552A (en) * 2012-12-11 2013-04-10 太仓市同维电子有限公司 Method for implementing software watchdog in software system
CN105119767A (en) * 2015-06-29 2015-12-02 北京宇航时代科技发展有限公司 Data self-check and self-cleaning software operation state monitoring method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1904852A (en) * 2006-08-01 2007-01-31 西安西电捷通无线网络通信有限公司 Method for monitoring and abnormal processing of computer application program
CN102331950A (en) * 2011-09-15 2012-01-25 北京安天电子设备有限公司 Method and system for realizing daemon process based on Linux timing task
CN103034552A (en) * 2012-12-11 2013-04-10 太仓市同维电子有限公司 Method for implementing software watchdog in software system
CN105119767A (en) * 2015-06-29 2015-12-02 北京宇航时代科技发展有限公司 Data self-check and self-cleaning software operation state monitoring method and system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107402814A (en) * 2017-07-07 2017-11-28 上海斐讯数据通信技术有限公司 A kind of method and system for saving internal memory in embedded systems
CN109426591A (en) * 2017-09-04 2019-03-05 武汉斗鱼网络科技有限公司 Guard the method and apparatus of multiple processes of the single program of windows
CN109426591B (en) * 2017-09-04 2021-01-01 武汉斗鱼网络科技有限公司 Method and equipment for guarding multiple processes of windows single program
CN109558257A (en) * 2017-09-26 2019-04-02 南京南瑞继保电气有限公司 A kind of application process guard method based on order line
CN108595273A (en) * 2018-05-10 2018-09-28 北京世纪东方通讯设备有限公司 A kind of Console program guard method and system
CN109815110A (en) * 2018-12-11 2019-05-28 北京城市网邻信息技术有限公司 A kind of network port management method, device, terminal device and storage medium
CN114791835A (en) * 2022-03-16 2022-07-26 青岛海尔科技有限公司 Program restarting method and device, storage medium and electronic device
CN114791835B (en) * 2022-03-16 2023-11-28 青岛海尔科技有限公司 Program restarting method and device, storage medium and electronic device
CN116055285A (en) * 2023-03-27 2023-05-02 西安热工研究院有限公司 Process management method and system of industrial control system

Similar Documents

Publication Publication Date Title
CN106371927A (en) Linux daemon process realization method and system
US8230201B2 (en) Migrating sleeping and waking threads between wake-and-go mechanisms in a multiple processor data processing system
US9417935B2 (en) Many-core process scheduling to maximize cache usage
KR101702700B1 (en) Fast computer startup
EP2431876B1 (en) Method and device for exception handling in embedded system
US20120222043A1 (en) Process Scheduling Using Scheduling Graph to Minimize Managed Elements
US20110173630A1 (en) Central Repository for Wake-and-Go Mechanism
US10140145B1 (en) Displaying guest operating system statistics in host task manager
CN105389197B (en) Operation method and device for capturing for the virtualization system based on container
US20090199030A1 (en) Hardware Wake-and-Go Mechanism for a Data Processing System
FR2950714A1 (en) SYSTEM AND METHOD FOR MANAGING THE INTERLEAVED EXECUTION OF INSTRUCTION WIRES
CN106959909A (en) A kind of application software abnormal restoring method in android system
CN107368343B (en) Terminal starting method based on android system, terminal and storage medium
US20110197193A1 (en) Device and method for controlling communication between bios and bmc
CN108388793B (en) Virtual machine escape protection method based on active defense
US20140109195A1 (en) Propagating security identity information to components of a composite application
CN115834448A (en) System and method for monitoring light-weight container flow on host side based on eBPF
CN104714839A (en) Method and device for controlling life cycle of processes
US20120198184A1 (en) Memory management method, computer system and computer readable medium
WO2011114476A1 (en) Multicore processor system, notification program, and notification method
CN105242981A (en) Configuration method of Kdump and computer device
CN112650541A (en) Application program starting acceleration method, system, equipment and storage medium
CN114184885A (en) Fault detection method, device and storage medium
CN110045992A (en) A kind of general-purpose system and method suitable for multicore board
US8762953B2 (en) Exception-based error handling in an array-based language

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170201

RJ01 Rejection of invention patent application after publication