aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-10-14 18:38:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-10-14 18:38:08 +0200
commit93ff2b4b5fb58a42a1012bf8cd91d0faa4e10b12 (patch)
tree8a0d8530d0c80f745b8bbd474a1f96039caf864d
parentee2d19445bfa6f0c6581bdcbf304d952d52809bf (diff)
downloadbusybox-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/README18
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
40process for an individual service. Service directories themselves sit 40process for an individual service. Service directories themselves sit
41inside a containing directory, and the runsvdir program supervises that 41inside a containing directory, and the runsvdir program supervises that
42directory, running one child runsv process for the service in each 42directory, running one child runsv process for the service in each
43subdirectory. Out of the box on Debian, for example, an instance of 43subdirectory. A typical choice is to start an instance of runsvdir
44runsvdir supervises services in subdirectories of /var/service/. 44which supervises services in subdirectories of /var/service/.
45 45
46If /var/service/log/ exists, runsv will supervise two services, 46If /var/service/log/ exists, runsv will supervise two services,
47and will connect stdout of main service to the stdin of log service. 47and 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,
94and in many cases you also want to babysit them. 94and in many cases you also want to babysit them.
95 95
96They present a case where different services need to control (start, stop, 96They present a case where different services need to control (start, stop,
97restart) eact other. 97restart) 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
111This is an example of service with has a "finish" script. If downed ("sv d"), 111This 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
113the interface. 113the 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
115addresses 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.
144It is responsible for all aspects of network configuration.
145
141This is an example of *one-shot* service. 146This is an example of *one-shot* service.
142 147
143It reconfigures network based on current known state of ALL interfaces. 148It 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
147One-shot-ness of this service means that it shuts itself off after single run. 152One-shot-ness of this service means that it shuts itself off after single run.
148IOW: it is not a constantly running daemon sort of thing. 153IOW: it is not a constantly running daemon sort of thing.
149It starts, it configures the network, it shuts down, all done 154It 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
152However, any dhcp/ppp/vpn or similar service can restart it anytime 157However, any dhcp/ppp/vpn or similar service can restart it anytime
153when it senses the change in network configuration. 158when 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 .
160at the very beginning of fw/run script, not at the end. 165at the very beginning of fw/run script, not at the end.
166
161Therefore, any "sv u /var/run/service/fw" command by any other 167Therefore, any "sv u /var/run/service/fw" command by any other
162script "undoes" o(ne-shot) command if fw still runs, thus 168script "undoes" o(ne-shot) command if fw still runs, thus
163runsv will rerun it; or start it in a normal way if fw is not running. 169runsv will rerun it; or start it in a normal way if fw is not running.
164 170
171This mechanism is the reason why fw is a service, not just a script.
172
165System administrators are expected to edit fw/run script, since 173System administrators are expected to edit fw/run script, since
166network configuration needs are likely to be very complex and different 174network configuration needs are likely to be very complex and different
167for non-trivial installations. 175for non-trivial installations.