CN106126262A - Nginx supports the method for Service Control Manager - Google Patents
Nginx supports the method for Service Control Manager Download PDFInfo
- Publication number
- CN106126262A CN106126262A CN201610516054.2A CN201610516054A CN106126262A CN 106126262 A CN106126262 A CN 106126262A CN 201610516054 A CN201610516054 A CN 201610516054A CN 106126262 A CN106126262 A CN 106126262A
- Authority
- CN
- China
- Prior art keywords
- service
- principal function
- nginx
- scm
- calls
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention provides a kind of method that nginx supports Service Control Manager, for windows system, including: described windows system creation logic thread;On the logic thread of the managing process of nginx, described logic thread calls service principal function;Described service principal function calls the first trust principal function;Described first entrusts principal function to call service initialisation module;The service initialisation of nginx is carried out in service initialisation module.The method of the embodiment of the present invention, by introducing the first trust principal function, be instead of the managing process of nginx in prior art by logic thread so that nginx runs in the way of Service Control Manager, and the compatibility control station method of operation.
Description
Technical field
The present invention relates to nginx technical field, particularly relate to a kind of method that nginx supports Service Control Manager.
Background technology
Nginx is that a famous high-performance is increased income Web and Reverse Proxy, supports windows and linux operation
System, because the most not supporting SCM (Service Control Manager) in windows system, so can only run with console mode,
But it is not so at running background, can not start before system login.
Summary of the invention
The technical problem to be solved is to provide a kind of method that nginx supports Service Control Manager, permissible
Nginx is made to support Service Control Manager in windows system.
In order to solve above-mentioned technical problem, technical scheme is as follows:
A kind of nginx supports the method for Service Control Manager, for windows system, including: described windows system
System creates logic thread;On the logic thread of the managing process of nginx, described logic thread calls service principal function;Described
Service principal function calls the first trust principal function;Described first entrusts principal function to call service initialisation module;Initial in service
Change the service initialisation carrying out nginx in module.
Further, described service principal function is called the process of the first trust principal function and is included: described service principal function inputs
Is_scm is 1, and is_scm is newly added parameter;After entrusting principal function to return when described first, update service state for stop
Only.
Further, the described first process entrusting principal function to call service initialisation module includes: whether judge is_scm
It is 0;If 0, then show version and the help information of nginx, and initialize log module;If not 0, then initialize log mould
Block;Judge whether is_scm is 1;If 1, the most described first entrusts principal function to call service initialisation module, then judges is_
Whether scm is 0;If not 1, then judge whether is_scm is 0;If 0, then test the configuration of nginx and process signal;If no
It is 0, then updates the service state of nginx for being currently running.
Further, the described process carrying out service initialisation in service initialisation module includes: registration procedure exits place
Reason device;Registration service controls processor;The service state of nginx is set in described service initialisation module for start.
Further, also include: the described managing process of described windows system start-up nginx;In described managing process
The first main thread call the first principal function;When there is user operation, described first main thread calls Service controll processor.
Further, the step that described the first main thread in described managing process calls the first principal function includes: initial
Change service and start table;Start Service controll scheduler program.
Further, in described Service controll processor, also include: user asks to stop the service of nginx;If stopping,
Then update the service state of nginx for stop, concurrently sending signalisation all working process to exit;If not stopping, then
Return.
Further, also include: in described managing process, create the progress of work;The second main line in the described progress of work
Journey calls the second principal function;Described second principal function calls the second trust principal function.
Further, described second principal function is called the process of the second trust principal function and is included: the service initializing nginx is opened
Dynamic table;Start Service controll scheduler program;Judge whether to run with console mode;The most then input is_scm is 0, and adjusts
Principal function is entrusted with second;If it is not, the most described second entrusts principal function to return.
Further: is_scm is used for identifying program run mode, if is_scm is not 0, then it represents that to manage with Service controll
Device mode is run, if is_scm is 0, then it represents that run with console mode.
Compared with prior art, the present invention includes advantages below:
1, the method for the embodiment of the present invention is by introducing the first trust principal function, logic thread instead of in prior art
The managing process of nginx so that nginx runs in the way of Service Control Manager, and the compatibility control station method of operation.
2, the method for the embodiment of the present invention uses process to exit processor, and unified report nginx service state is for stop.
Accompanying drawing explanation
Fig. 1 is the flow chart of the method for the nginx support Service Control Manager of the embodiment of the present invention;
Fig. 2 is that the service principal function of the method for the nginx support Service Control Manager of the embodiment of the present invention calls first
Entrust the flow chart of principal function step;
Fig. 3 is that the first trust principal function of the method for the nginx support Service Control Manager of the embodiment of the present invention is called
The flow chart of service initialisation module step;
Fig. 4 be the embodiment of the present invention nginx support Service Control Manager method in service initialisation module
Carry out the flow chart of the service initialisation step of nginx;
Fig. 5 is the flow chart of the method for the nginx support Service Control Manager of another embodiment of the present invention;
Fig. 6 be another embodiment of the present invention nginx support Service Control Manager method in managing process
First main thread calls the flow chart of the first principal function step;
Fig. 7 is processing at Service controll of the method for the nginx support Service Control Manager of another embodiment of the present invention
The flow chart of the step in device;
Fig. 8 is the flow chart of the method for the nginx support Service Control Manager of further embodiment of this invention;
Fig. 9 is that the second principal function of the method for the nginx support Service Control Manager of further embodiment of this invention is called
Second flow chart entrusting principal function step.
Detailed description of the invention
Understandable for enabling the above-mentioned purpose of the present invention, feature and advantage to become apparent from, real with concrete below in conjunction with the accompanying drawings
The present invention is further detailed explanation to execute mode.
Heretofore described " first " and " second " is only used for distinguishing, and does not has practical significance.
The embodiment of the invention discloses a kind of method that nginx supports Service Control Manager, for windows system.
As it is shown in figure 1, be the flow chart of the method for the nginx support Service Control Manager of the embodiment of the present invention.The method is specifically wrapped
Include following process:
Step S101:windows system creation logic thread.
Step S102: on the logic thread of the managing process of nginx, logic thread calls service principal function.
Step S103: service principal function calls the first trust principal function.
During coding, entrust principal function can represent with ngx_main.
Step S104: first entrusts principal function to call service initialisation module.
Step S105: carry out the service initialisation of nginx in service initialisation module.
The method of the embodiment of the present invention, by introducing the first trust principal function, be instead of in prior art by logic thread
The managing process of nginx so that nginx runs in the way of Service Control Manager, and the compatibility control station method of operation.
Concrete, as in figure 2 it is shown, the process of step S103 specifically includes:
Step S1031: service principal function input is_scm is 1.
Wherein, is_scm is newly added parameter.Is_scm is used for identifying program run mode, if is_scm is not 0, then
Represent and run in Service Control Manager mode, if is_scm is 0, then it represents that run with console mode.
Step S1032: after entrusting principal function to return when first, update the service state of nginx for stop.
Logic thread instead of the managing process of prior art nginx, shows that nginx is with Service Control Manager
Mode is run, so being 1 to call the first trust principal function with is_scm, when first entrusts principal function to return, indicates that management
Process exits, it should the service state of renewal nginx, for stop, being then back to show that current service finishes.
Concrete, as it is shown on figure 3, the process of step S104 specifically includes:
Step S1041: judge whether is_scm is 0.
If 0, carry out step S1042 and S1043 the most successively;If not 0, then carry out step S1043.
Step S1042: the version of display nginx and help information.
Step S1043: initialize log module.
Owing to service initialisation must be by error logging in log (daily record), so service initialisation module should initialize
Call after log module.
Step S1044: judge whether is_scm is 1.
If 1, carry out step S1045 and S1046 the most successively.If not 1, then carry out step S1046.
Step S1045: first entrusts principal function to call service initialisation module.
Step S1046: judge whether is_scm is 0.
If 0, then carry out step S1047;If not 0, then carry out step S1048.
Step S1047: the configuration of test nginx and process signal.
Step S1048: update the service state of nginx for being currently running.
Concrete, as shown in Figure 4, the process of step S105 specifically includes:
Step S1051: registration procedure exits processor.
Step S1052: registration service controls processor.
Step S1053: the service state of nginx is set in service initialisation module for start.
In realizing at nginx, exception error directly exits to have many places to occur, the process that first have registered exits
Processor, within it report services state is for stop, as long as so process exits, just seeing on Service Control Manager
To the state stopped.
As it is shown in figure 5, be the flow chart of the method for the nginx support Service Control Manager of another embodiment of the present invention.
Preferably, coordinating with the flow process of logic thread, the method for another embodiment of the present invention also includes:
The managing process of step S201:windows system start-up nginx.
Step S202: the first main thread in managing process calls the first principal function.
Step S203: when there is user operation, the first main thread calls Service controll processor.
Concrete, as shown in Figure 6, step S202 specifically includes:
Step S2021: the service of initialization starts table.
Step S2022: start Service controll scheduler program.
Concrete, as it is shown in fig. 7, in Service controll processor, the method also specifically includes:
Step S301: user asks to stop the service of nginx.
If stopping, then carry out step S302;If not stopping, then carry out step S303.
Step S302: the service state of renewal nginx, for stop, concurrently sending signalisation all working process to move back
Go out.
Step S303: return.
Flow process in this Service controll processor is a kind of asynchronous execution stream.Can ask when stopping from Service Control Manager
Ask stopping service, can first ask to stop service, again request when restarting service and start service.This step has processed simply stops
Only request, other such as suspends, continue and the request such as shutdown, can extend according to real needs.
As shown in Figure 8, the nginx for further embodiment of this invention supports the flow chart of method of Service Control Manager.
Preferably, coordinating with the flow process of logic thread, the method for further embodiment of this invention also includes:
Step S401: create the progress of work in managing process.
Step S402: the second main thread in the progress of work calls the second principal function.
Step S403: the second principal function calls the second trust principal function.
Concrete, as it is shown in figure 9, the detailed process of step S403 includes:
Step S4031: the service initializing nginx starts table.
Step S4032: start Service controll scheduler program.
Step S4033: judge whether to run with console mode.
The most then carry out step S4044;If it is not, then carry out step S4045.
Step S4044: input is_scm is 0, and calls the second trust principal function.
Step S4045: second entrusts principal function to return.
If with start up with command-line options nginx, namely managing process, or when nginx produces the progress of work, then to control
Platform mode calls the second principal function, and then is 0 to call the second trust principal function, when second entrusts principal function to return with is_scm
Time, mean that managing process or the progress of work exit.
Above to technical scheme provided by the present invention, being described in detail, specific case used herein is to this
Principle and the embodiment of invention are set forth, the explanation of above example be only intended to help to understand the method for the present invention and
Its core concept;Simultaneously for one of ordinary skill in the art, according to the thought of the present invention, in detailed description of the invention and should
All will change with in scope, in sum, this specification content should not be construed as limitation of the present invention.
Claims (10)
1. the method that nginx supports Service Control Manager, for windows system, it is characterised in that including:
Described windows system creation logic thread;
On the logic thread of the managing process of nginx, described logic thread calls service principal function;
Described service principal function calls the first trust principal function;
Described first entrusts principal function to call service initialisation module;
The service initialisation of nginx is carried out in service initialisation module.
2. the method for claim 1, it is characterised in that described service principal function calls the process of the first trust principal function
Including:
Described service principal function input is_scm is 1, and is_scm is newly added parameter;
After entrusting principal function to return when described first, update service state for stop.
3. the method for claim 1, it is characterised in that described first entrusts principal function to call service initialisation module
Process includes:
Judge whether is_scm is 0;
If 0, then show version and the help information of nginx, and initialize log module;If not 0, then initialize log mould
Block;
Judge whether is_scm is 1;
If 1, the most described first entrusts principal function to call service initialisation module, then judges whether is_scm is 0;If not
1, then judge whether is_scm is 0;
If 0, then test the configuration of nginx and process signal;If not 0, then update the service state of nginx for transport
OK.
4. the method for claim 1, it is characterised in that described carry out service initialisation in service initialisation module
Process includes:
Registration procedure exits processor;
Registration service controls processor;
The service state of nginx is set in described service initialisation module for start.
5. the method for claim 1, it is characterised in that also include:
The described managing process of described windows system start-up nginx;
The first main thread in described managing process calls the first principal function;
When there is user operation, described first main thread calls Service controll processor.
6. method as claimed in claim 5, it is characterised in that described the first main thread in described managing process calls the
The step of one principal function includes:
The service of initialization starts table;
Start Service controll scheduler program.
7. method as claimed in claim 5, it is characterised in that in described Service controll processor, also include:
User asks to stop the service of nginx;
If stopping, then update the service state of nginx for stop, concurrently sending signalisation all working process to exit;If
Do not stop, then return.
8. the method for claim 1, it is characterised in that also include:
The progress of work is created in described managing process;
The second main thread in the described progress of work calls the second principal function;
Described second principal function calls the second trust principal function.
9. method as claimed in claim 8, it is characterised in that described second principal function calls the process of the second trust principal function
Including:
The service initializing nginx starts table;
Start Service controll scheduler program;
Judge whether to run with console mode;
The most then input is_scm is 0, and calls the second trust principal function;If it is not, the most described second entrusts principal function to return
Return.
10. the method as described in any one of claim 2,3 or 9, it is characterised in that: is_scm is used for identifying program operation side
Formula, if is_scm is not 0, then it represents that run in Service Control Manager mode, if is_scm is 0, then it represents that with control station side
Formula is run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610516054.2A CN106126262A (en) | 2016-07-01 | 2016-07-01 | Nginx supports the method for Service Control Manager |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610516054.2A CN106126262A (en) | 2016-07-01 | 2016-07-01 | Nginx supports the method for Service Control Manager |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106126262A true CN106126262A (en) | 2016-11-16 |
Family
ID=57469270
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610516054.2A Pending CN106126262A (en) | 2016-07-01 | 2016-07-01 | Nginx supports the method for Service Control Manager |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106126262A (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101883019A (en) * | 2010-03-15 | 2010-11-10 | 浪潮电子信息产业股份有限公司 | Test method for verifying video application of storage server |
-
2016
- 2016-07-01 CN CN201610516054.2A patent/CN106126262A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101883019A (en) * | 2010-03-15 | 2010-11-10 | 浪潮电子信息产业股份有限公司 | Test method for verifying video application of storage server |
Non-Patent Citations (1)
Title |
---|
QINQING1984: "nginx iocp:scm服务控制", 《好库文摘》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230297364A1 (en) | System And Method For Upgrading Kernels In Cloud Computing Environments | |
US11294698B2 (en) | Waiting a host determined specific amount of time before performing virtual network function migration | |
US8392919B2 (en) | Runtime environment for virtualizing information technology appliances | |
CA2840437C (en) | Virtual machine migration tool | |
US7925791B2 (en) | Recoverable error detection for concurrent computing programs | |
KR100989613B1 (en) | Terminal device for executing android application based non-android flatform | |
US9396028B2 (en) | Scheduling workloads and making provision decisions of computer resources in a computing environment | |
US10656971B2 (en) | Agile framework for vertical application development and delivery | |
KR20040086214A (en) | Enhanced runtime hosting | |
KR101015573B1 (en) | Device for executing android application based on rtos | |
US7716663B2 (en) | Method, system and program product for controlling native applications using open service gateway initiative (OSGi) bundles | |
CN105242962A (en) | Quick lightweight thread triggering method based on heterogeneous many-core | |
US8739151B1 (en) | Computer system using in-service software upgrade | |
KR102140730B1 (en) | Method and system for providing develop environment of deep learning based gpu | |
CN106170763A (en) | A kind of software check method and apparatus | |
US20240086228A1 (en) | Resource Configuration Method and Apparatus, Electronic Device, and Computer-Readable Storage Medium | |
US10318343B2 (en) | Migration methods and apparatuses for migrating virtual machine including locally stored and shared data | |
CN111381965A (en) | Method and apparatus for processing requests | |
CN112948102B (en) | Virtual machine event processing method, device and system | |
CN106126262A (en) | Nginx supports the method for Service Control Manager | |
CN108073426A (en) | A kind of method of managing software based on cloud computing, apparatus and system | |
WO2023137996A1 (en) | Application control method, gesture processing apparatus, intelligent terminal, and vehicle | |
US10417051B2 (en) | Synchronizing shared resources in an order processing environment using a synchronization component | |
CN114968776A (en) | Application program detection method and device | |
Armand et al. | Shared device driver model for virtualized mobile handsets |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161116 |