diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-14 18:38:08 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-14 18:38:08 +0200 |
commit | 93ff2b4b5fb58a42a1012bf8cd91d0faa4e10b12 (patch) | |
tree | 8a0d8530d0c80f745b8bbd474a1f96039caf864d | |
parent | ee2d19445bfa6f0c6581bdcbf304d952d52809bf (diff) | |
download | busybox-w32-93ff2b4b5fb58a42a1012bf8cd91d0faa4e10b12.tar.gz busybox-w32-93ff2b4b5fb58a42a1012bf8cd91d0faa4e10b12.tar.bz2 busybox-w32-93ff2b4b5fb58a42a1012bf8cd91d0faa4e10b12.zip |
examples: update var_service/README again
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/var_service/README | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/examples/var_service/README b/examples/var_service/README index 52dd781ef..41106b5ae 100644 --- a/examples/var_service/README +++ b/examples/var_service/README | |||
@@ -40,8 +40,8 @@ There are just two key programs in runit. Firstly, runsv supervises the | |||
40 | process for an individual service. Service directories themselves sit | 40 | process for an individual service. Service directories themselves sit |
41 | inside a containing directory, and the runsvdir program supervises that | 41 | inside a containing directory, and the runsvdir program supervises that |
42 | directory, running one child runsv process for the service in each | 42 | directory, running one child runsv process for the service in each |
43 | subdirectory. Out of the box on Debian, for example, an instance of | 43 | subdirectory. A typical choice is to start an instance of runsvdir |
44 | runsvdir supervises services in subdirectories of /var/service/. | 44 | which supervises services in subdirectories of /var/service/. |
45 | 45 | ||
46 | If /var/service/log/ exists, runsv will supervise two services, | 46 | If /var/service/log/ exists, runsv will supervise two services, |
47 | and will connect stdout of main service to the stdin of log service. | 47 | and will connect stdout of main service to the stdin of log service. |
@@ -94,7 +94,7 @@ dhcp, zeroconf, ppp, openvpn and such. They need to be controlled, | |||
94 | and in many cases you also want to babysit them. | 94 | and in many cases you also want to babysit them. |
95 | 95 | ||
96 | They present a case where different services need to control (start, stop, | 96 | They present a case where different services need to control (start, stop, |
97 | restart) eact other. | 97 | restart) each other. |
98 | 98 | ||
99 | var_service/dhcp_if | 99 | var_service/dhcp_if |
100 | 100 | ||
@@ -110,7 +110,9 @@ dynamic network link services (ppp/vpn/zcip). | |||
110 | 110 | ||
111 | This is an example of service with has a "finish" script. If downed ("sv d"), | 111 | This is an example of service with has a "finish" script. If downed ("sv d"), |
112 | "finish" is executed. For this service, it removes DHCP address from | 112 | "finish" is executed. For this service, it removes DHCP address from |
113 | the interface. | 113 | the interface. This is useful when ifplugd detects that the the link is dead |
114 | (cable is no longer attached anywhere) and downs us - keeping DHCP configured | ||
115 | addresses on the interface would make kernel still try to use it. | ||
114 | 116 | ||
115 | var_service/zcip_if | 117 | var_service/zcip_if |
116 | 118 | ||
@@ -138,6 +140,9 @@ inteface "if". | |||
138 | 140 | ||
139 | var_service/fw | 141 | var_service/fw |
140 | 142 | ||
143 | "Firewall" script, although it is tasked with much more than setting up firewall. | ||
144 | It is responsible for all aspects of network configuration. | ||
145 | |||
141 | This is an example of *one-shot* service. | 146 | This is an example of *one-shot* service. |
142 | 147 | ||
143 | It reconfigures network based on current known state of ALL interfaces. | 148 | It reconfigures network based on current known state of ALL interfaces. |
@@ -147,7 +152,7 @@ Uses conf/*.ipconf (static config) and /var/run/service/fw/*.ipconf | |||
147 | One-shot-ness of this service means that it shuts itself off after single run. | 152 | One-shot-ness of this service means that it shuts itself off after single run. |
148 | IOW: it is not a constantly running daemon sort of thing. | 153 | IOW: it is not a constantly running daemon sort of thing. |
149 | It starts, it configures the network, it shuts down, all done | 154 | It starts, it configures the network, it shuts down, all done |
150 | (unlike infamous NetworkManagers which sit in RAM forever, doing hell knows what). | 155 | (unlike infamous NetworkManagers which sit in RAM forever). |
151 | 156 | ||
152 | However, any dhcp/ppp/vpn or similar service can restart it anytime | 157 | However, any dhcp/ppp/vpn or similar service can restart it anytime |
153 | when it senses the change in network configuration. | 158 | when it senses the change in network configuration. |
@@ -158,10 +163,13 @@ This is achieved very simply by having | |||
158 | # Make ourself one-shot | 163 | # Make ourself one-shot |
159 | sv o . | 164 | sv o . |
160 | at the very beginning of fw/run script, not at the end. | 165 | at the very beginning of fw/run script, not at the end. |
166 | |||
161 | Therefore, any "sv u /var/run/service/fw" command by any other | 167 | Therefore, any "sv u /var/run/service/fw" command by any other |
162 | script "undoes" o(ne-shot) command if fw still runs, thus | 168 | script "undoes" o(ne-shot) command if fw still runs, thus |
163 | runsv will rerun it; or start it in a normal way if fw is not running. | 169 | runsv will rerun it; or start it in a normal way if fw is not running. |
164 | 170 | ||
171 | This mechanism is the reason why fw is a service, not just a script. | ||
172 | |||
165 | System administrators are expected to edit fw/run script, since | 173 | System administrators are expected to edit fw/run script, since |
166 | network configuration needs are likely to be very complex and different | 174 | network configuration needs are likely to be very complex and different |
167 | for non-trivial installations. | 175 | for non-trivial installations. |