diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-25 20:41:00 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-25 20:41:00 +0100 |
commit | 96f1d6b70c6c27798df6867d3cd98b385da624ea (patch) | |
tree | 4c3ae892986f5656c40f23a0f353ad60baaba418 | |
parent | 7d5c881bd0cbf3cb1a755acf95a00b37625f7628 (diff) | |
download | busybox-w32-96f1d6b70c6c27798df6867d3cd98b385da624ea.tar.gz busybox-w32-96f1d6b70c6c27798df6867d3cd98b385da624ea.tar.bz2 busybox-w32-96f1d6b70c6c27798df6867d3cd98b385da624ea.zip |
Update to examples/var_service/README_distro_proposal.txt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/var_service/README_distro_proposal.txt | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/examples/var_service/README_distro_proposal.txt b/examples/var_service/README_distro_proposal.txt index 9b3fe04ba..8140facba 100644 --- a/examples/var_service/README_distro_proposal.txt +++ b/examples/var_service/README_distro_proposal.txt | |||
@@ -98,10 +98,10 @@ It is not required that a specific clone should be used. Let evolution work. | |||
98 | daemon: any long running background program. Common examples are sshd, getty, | 98 | daemon: any long running background program. Common examples are sshd, getty, |
99 | ntpd, dhcp client... | 99 | ntpd, dhcp client... |
100 | 100 | ||
101 | service: same as "daemon" | 101 | service: daemon controlled by a service monitor. |
102 | 102 | ||
103 | service directory: a directory with an executable file (script) named "run" | 103 | service directory: a directory with an executable file (script) named "run" |
104 | which (usually) execs daemon (possibly after some preparatory steps). | 104 | which (usually) execs some daemon, possibly after some preparatory steps. |
105 | It should start it not as a child or daemonized process, but by exec'ing it | 105 | It should start it not as a child or daemonized process, but by exec'ing it |
106 | (inheriting the same PID and the place in the process tree). | 106 | (inheriting the same PID and the place in the process tree). |
107 | 107 | ||
@@ -116,7 +116,7 @@ whose directories disappeared. | |||
116 | 116 | ||
117 | supervisor: a tool which monitors one service directory. | 117 | supervisor: a tool which monitors one service directory. |
118 | It runs "run" script as its child. It restarts it if it dies. | 118 | It runs "run" script as its child. It restarts it if it dies. |
119 | It can be instructed to start/top/signal its child. | 119 | It can be instructed to start/stop/signal its child. |
120 | In daemontools package, it is called "supervise". In runit, it is called | 120 | In daemontools package, it is called "supervise". In runit, it is called |
121 | "runsv". In s6, it is called "s6-supervise". | 121 | "runsv". In s6, it is called "s6-supervise". |
122 | 122 | ||
@@ -150,7 +150,9 @@ The less distros diverge, the easier users' lives are. | |||
150 | 150 | ||
151 | System-wide service dirs reside in a distro-specific location. | 151 | System-wide service dirs reside in a distro-specific location. |
152 | The recommended location is /var/service. (However, since it is not | 152 | The recommended location is /var/service. (However, since it is not |
153 | a mandatory location, avoid depending on it in your run scripts). | 153 | a mandatory location, avoid depending on it in your run scripts. |
154 | Void Linux wanted to have it somewhere in /run/*, and they solved this | ||
155 | by making /var/service a symlink). | ||
154 | 156 | ||
155 | The install location for service dirs is /etc/rc: | 157 | The install location for service dirs is /etc/rc: |
156 | when e.g. ntpd daemon is installed, it creates the /etc/rc/ntpd | 158 | when e.g. ntpd daemon is installed, it creates the /etc/rc/ntpd |
@@ -182,10 +184,14 @@ of bad things may happen. This may be worked around by various | |||
182 | heuristics in service monitor which give new service a few seconds | 184 | heuristics in service monitor which give new service a few seconds |
183 | of "grace time" to be fully populated; but this is not yet | 185 | of "grace time" to be fully populated; but this is not yet |
184 | implemented in any of three packages. | 186 | implemented in any of three packages. |
187 | This also may be worked around by creating a .dotdir (a directory | ||
188 | whose name starts with a dot), populating it, and then renaming; | ||
189 | but packaging tools usually do not have an option to do this | ||
190 | automatically - additional install stripting in packages will be needed. | ||
185 | 191 | ||
186 | Daemons' output file descriptors are handled somewhat awkwardly | 192 | Daemons' output file descriptors are handled somewhat awkwardly |
187 | by various daemontools implementations. For example, for runit tools, | 193 | by various daemontools implementations. For example, for runit tools, |
188 | daemons' stdout goes to wherever runsdir's stdout was directied; | 194 | daemons' stdout goes to wherever runsvdir's stdout was directied; |
189 | stderr goes to runsvdir, which in turn "rotates" it on its command line | 195 | stderr goes to runsvdir, which in turn "rotates" it on its command line |
190 | (which is visible in ps output). | 196 | (which is visible in ps output). |
191 | 197 | ||
@@ -236,11 +242,11 @@ there is no guarantee in which order commands are sent to them. | |||
236 | If DIR has no slash and is not "." or "..", it is assumed to be | 242 | If DIR has no slash and is not "." or "..", it is assumed to be |
237 | relative to the system-wide service directory. | 243 | relative to the system-wide service directory. |
238 | 244 | ||
239 | The "svok DIR" tool exits 0 if service is running, and nonzero if not. | 245 | [Currently, "svc" exists only in daemontools and in busybox. |
246 | This proposal asks developrs of other daemontools implementations | ||
247 | to add "svc" command to their projects] | ||
240 | 248 | ||
241 | The "svstat DIR1 DIR2..." prints one human-readable line for each directory, | 249 | The "svok DIR" tool exits 0 if service is running, and nonzero if not. |
242 | saying whether supervise is successfully running in that directory, | ||
243 | and reporting the status information maintained by supervise. | ||
244 | 250 | ||
245 | Other tools with different names and APIs may exist; however | 251 | Other tools with different names and APIs may exist; however |
246 | for portability scripts should use the above tools. | 252 | for portability scripts should use the above tools. |
@@ -253,15 +259,16 @@ depending on the distro) its files to the "live" service directory, | |||
253 | whereever it is located on this distro. | 259 | whereever it is located on this distro. |
254 | 260 | ||
255 | Removal of the service should be done as follows: | 261 | Removal of the service should be done as follows: |
256 | svc -d DIR [DIR/log], then remove the service directory | 262 | svc -d DIR [DIR/log], then remove the service directory: |
257 | (this makes service monitor SIGTERM per-directory supervisors | 263 | this makes service monitor SIGTERM per-directory supervisors |
258 | (if they exist in the implementation)) | 264 | (if they exist in the implementation). |
259 | 265 | ||
260 | 266 | ||
261 | Implementation details | 267 | Implementation details |
262 | 268 | ||
263 | Top-level service monitor program name is not standardized. | 269 | Top-level service monitor program name is not standardized |
264 | [svscan, runsvdir, s6-svscan ...] | 270 | [svscan, runsvdir, s6-svscan ...] - it does not need to be, |
271 | as far as daemon packagers are concerned. | ||
265 | 272 | ||
266 | It may run one per-directory supervisor, or two supervisors | 273 | It may run one per-directory supervisor, or two supervisors |
267 | (one for DIR/ and one for DIR/log/); for memory-constrained systems | 274 | (one for DIR/ and one for DIR/log/); for memory-constrained systems |