diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-24 14:55:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-24 14:55:33 +0200 |
commit | 4f8ecf273c4a239d007125f3b96a55100b661c04 (patch) | |
tree | 680b7a535f119f2bfb2e820adb2be5d537ccb99a | |
parent | d32a1a4054444d8193736ee4c5f515fa90dbb24f (diff) | |
download | busybox-w32-4f8ecf273c4a239d007125f3b96a55100b661c04.tar.gz busybox-w32-4f8ecf273c4a239d007125f3b96a55100b661c04.tar.bz2 busybox-w32-4f8ecf273c4a239d007125f3b96a55100b661c04.zip |
update network service examples
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | examples/var_service/dhcp_if/convert2ntpconf | 2 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/dhcp_handler | 13 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/finish | 17 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if_pinger/run | 4 | ||||
-rwxr-xr-x | examples/var_service/ftpd/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/fw/run | 2 | ||||
-rwxr-xr-x | examples/var_service/httpd/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/ifplugd_if/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/ifplugd_if/run | 3 | ||||
-rwxr-xr-x | examples/var_service/inetd/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/ntpd/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/ntpd/run | 2 | ||||
-rwxr-xr-x | examples/var_service/tftpd/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/zcip_if/finish | 13 | ||||
-rwxr-xr-x | examples/var_service/zcip_if/log/run | 2 | ||||
-rwxr-xr-x | examples/var_service/zcip_if/zcip_handler | 3 |
17 files changed, 55 insertions, 20 deletions
diff --git a/examples/var_service/dhcp_if/convert2ntpconf b/examples/var_service/dhcp_if/convert2ntpconf index debf1ebfe..e9d829308 100755 --- a/examples/var_service/dhcp_if/convert2ntpconf +++ b/examples/var_service/dhcp_if/convert2ntpconf | |||
@@ -29,6 +29,6 @@ test "$ip" || exit 1 | |||
29 | { | 29 | { |
30 | for n in $ntpsrv; do | 30 | for n in $ntpsrv; do |
31 | echo "let cfg=cfg+1" | 31 | echo "let cfg=cfg+1" |
32 | echo "ntpip[\$cfg]='$n'"; | 32 | echo "ntpip[\$cfg]='$n'" |
33 | done | 33 | done |
34 | } >"$1" | 34 | } >"$1" |
diff --git a/examples/var_service/dhcp_if/dhcp_handler b/examples/var_service/dhcp_if/dhcp_handler index 927e02a17..3d2a5cb79 100755 --- a/examples/var_service/dhcp_if/dhcp_handler +++ b/examples/var_service/dhcp_if/dhcp_handler | |||
@@ -36,7 +36,7 @@ service=${PWD##*/} | |||
36 | file_ipconf="$service.ipconf" | 36 | file_ipconf="$service.ipconf" |
37 | file_ntpconf="$service.ntpconf" | 37 | file_ntpconf="$service.ntpconf" |
38 | dir_ipconf="/var/run/service/fw" | 38 | dir_ipconf="/var/run/service/fw" |
39 | dir_ntpconf="/var/run/service/ntp" | 39 | dir_ntpconf="/var/run/service/ntpd" |
40 | 40 | ||
41 | exec >/dev/null | 41 | exec >/dev/null |
42 | #exec >>"$0.out" #debug | 42 | #exec >>"$0.out" #debug |
@@ -47,7 +47,7 @@ echo "`date`: Params: $*" | |||
47 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then | 47 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then |
48 | # Reconfigure network with this interface disabled | 48 | # Reconfigure network with this interface disabled |
49 | echo "Deconfiguring" | 49 | echo "Deconfiguring" |
50 | rm "$service.out" | 50 | rm "env.out" |
51 | rm "$file_ipconf" | 51 | rm "$file_ipconf" |
52 | rm "$file_ntpconf" | 52 | rm "$file_ntpconf" |
53 | rm "$dir_ipconf/$file_ipconf" | 53 | rm "$dir_ipconf/$file_ipconf" |
@@ -57,7 +57,8 @@ if test x"$1" != x"bound" && test x"$1" != x"renew" ; then | |||
57 | fi | 57 | fi |
58 | 58 | ||
59 | # Bound: we've got the lease | 59 | # Bound: we've got the lease |
60 | #env >"$service.out" # debug | 60 | # Record information for e.g. dhcp_$IF_pinger service |
61 | env >"env.out" | ||
61 | 62 | ||
62 | ./convert2ipconf "$file_ipconf" | 63 | ./convert2ipconf "$file_ipconf" |
63 | # Reconfigure routing and firewall if needed | 64 | # Reconfigure routing and firewall if needed |
@@ -69,7 +70,7 @@ if test $? != 0; then | |||
69 | sv u /var/service/fw | 70 | sv u /var/service/fw |
70 | fi | 71 | fi |
71 | 72 | ||
72 | if test -d /var/service/ntp; then | 73 | if test -d /var/service/ntpd; then |
73 | ./convert2ntpconf "$file_ntpconf" | 74 | ./convert2ntpconf "$file_ntpconf" |
74 | # Reconfigure ntp server addresses if needed | 75 | # Reconfigure ntp server addresses if needed |
75 | diff --brief "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" >/dev/null 2>&1 | 76 | diff --brief "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" >/dev/null 2>&1 |
@@ -77,7 +78,7 @@ if test -d /var/service/ntp; then | |||
77 | echo "Reconfiguring ntp" | 78 | echo "Reconfiguring ntp" |
78 | mkdir -p "$dir_ntpconf" 2>/dev/null | 79 | mkdir -p "$dir_ntpconf" 2>/dev/null |
79 | cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" | 80 | cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" |
80 | sv t /var/service/ntp | 81 | sv t /var/service/ntpd |
81 | sv u /var/service/ntp | 82 | sv u /var/service/ntpd |
82 | fi | 83 | fi |
83 | fi | 84 | fi |
diff --git a/examples/var_service/dhcp_if/finish b/examples/var_service/dhcp_if/finish new file mode 100755 index 000000000..5e7667a2d --- /dev/null +++ b/examples/var_service/dhcp_if/finish | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/bin/sh | ||
2 | # executed when service is taken down ("sv d .") | ||
3 | |||
4 | service=${PWD##*/} | ||
5 | file_ipconf="$service.ipconf" | ||
6 | file_ntpconf="$service.ntpconf" | ||
7 | dir_ipconf="/var/run/service/fw" | ||
8 | dir_ntpconf="/var/run/service/ntpd" | ||
9 | |||
10 | # Reconfigure network with this interface disabled | ||
11 | echo "Finish: deconfiguring" | ||
12 | rm "env.out" | ||
13 | rm "$file_ipconf" | ||
14 | rm "$file_ntpconf" | ||
15 | rm "$dir_ipconf/$file_ipconf" | ||
16 | rm "$dir_ntpconf/$file_ntpconf" | ||
17 | sv u /var/service/fw | ||
diff --git a/examples/var_service/dhcp_if/log/run b/examples/var_service/dhcp_if/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/dhcp_if/log/run +++ b/examples/var_service/dhcp_if/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/dhcp_if_pinger/run b/examples/var_service/dhcp_if_pinger/run index 1868510d1..e0e87a16a 100755 --- a/examples/var_service/dhcp_if_pinger/run +++ b/examples/var_service/dhcp_if_pinger/run | |||
@@ -21,9 +21,9 @@ if test -f "$0.log"; then | |||
21 | mv "$0.log.new" "$0.log" | 21 | mv "$0.log.new" "$0.log" |
22 | fi | 22 | fi |
23 | 23 | ||
24 | test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$ping_time" | 24 | test -f "/var/service/dhcp_$if/env.out" || exec env - sleep "$ping_time" |
25 | 25 | ||
26 | . "/var/service/dhcp_$if/dhcp_$if.out" | 26 | . "/var/service/dhcp_$if/env.out" |
27 | test x"$router" != x"" || exec env - sleep "$ping_time" | 27 | test x"$router" != x"" || exec env - sleep "$ping_time" |
28 | 28 | ||
29 | #msg "Pinging $router" | 29 | #msg "Pinging $router" |
diff --git a/examples/var_service/ftpd/log/run b/examples/var_service/ftpd/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/ftpd/log/run +++ b/examples/var_service/ftpd/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/fw/run b/examples/var_service/fw/run index 396b678ab..81c7f2e7c 100755 --- a/examples/var_service/fw/run +++ b/examples/var_service/fw/run | |||
@@ -62,7 +62,7 @@ umask 077 | |||
62 | 62 | ||
63 | # Make sure rundir/ exists | 63 | # Make sure rundir/ exists |
64 | mkdir -p "$rundir" 2>/dev/null | 64 | mkdir -p "$rundir" 2>/dev/null |
65 | chown -R "$user:" "$rundir" | 65 | chown -R "$user": "$rundir" |
66 | chmod -R a=rX "$rundir" | 66 | chmod -R a=rX "$rundir" |
67 | rm -rf rundir 2>/dev/null | 67 | rm -rf rundir 2>/dev/null |
68 | ln -s "$rundir" rundir | 68 | ln -s "$rundir" rundir |
diff --git a/examples/var_service/httpd/log/run b/examples/var_service/httpd/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/httpd/log/run +++ b/examples/var_service/httpd/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/ifplugd_if/log/run b/examples/var_service/ifplugd_if/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/ifplugd_if/log/run +++ b/examples/var_service/ifplugd_if/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/ifplugd_if/run b/examples/var_service/ifplugd_if/run index 2781cf9f9..c4f766e88 100755 --- a/examples/var_service/ifplugd_if/run +++ b/examples/var_service/ifplugd_if/run | |||
@@ -8,6 +8,9 @@ pwd="$PWD" | |||
8 | 8 | ||
9 | if="${PWD##*/ifplugd_}" | 9 | if="${PWD##*/ifplugd_}" |
10 | 10 | ||
11 | echo "* Upping iface $if" | ||
12 | ip link set dev "$if" up | ||
13 | |||
11 | echo "* Starting ifplugd on $if [$$]" | 14 | echo "* Starting ifplugd on $if [$$]" |
12 | exec \ | 15 | exec \ |
13 | env - PATH="$PATH" \ | 16 | env - PATH="$PATH" \ |
diff --git a/examples/var_service/inetd/log/run b/examples/var_service/inetd/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/inetd/log/run +++ b/examples/var_service/inetd/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/ntpd/log/run b/examples/var_service/ntpd/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/ntpd/log/run +++ b/examples/var_service/ntpd/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/ntpd/run b/examples/var_service/ntpd/run index 581d231a3..6f2a68188 100755 --- a/examples/var_service/ntpd/run +++ b/examples/var_service/ntpd/run | |||
@@ -15,7 +15,7 @@ default_p_opt="-p 0.$pool -p 1.$pool -p 2.$pool -p 3.$pool" | |||
15 | 15 | ||
16 | # Make sure rundir/ exists | 16 | # Make sure rundir/ exists |
17 | mkdir -p "$rundir" 2>/dev/null | 17 | mkdir -p "$rundir" 2>/dev/null |
18 | chown -R "$user:" "$rundir" | 18 | chown -R "$user": "$rundir" |
19 | chmod -R a=rX "$rundir" | 19 | chmod -R a=rX "$rundir" |
20 | rm -rf rundir 2>/dev/null | 20 | rm -rf rundir 2>/dev/null |
21 | ln -s "$rundir" rundir | 21 | ln -s "$rundir" rundir |
diff --git a/examples/var_service/tftpd/log/run b/examples/var_service/tftpd/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/tftpd/log/run +++ b/examples/var_service/tftpd/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/zcip_if/finish b/examples/var_service/zcip_if/finish new file mode 100755 index 000000000..95995cf5f --- /dev/null +++ b/examples/var_service/zcip_if/finish | |||
@@ -0,0 +1,13 @@ | |||
1 | #!/bin/sh | ||
2 | # executed when service is taken down ("sv d .") | ||
3 | |||
4 | service=${PWD##*/} | ||
5 | file_ipconf="$service.ipconf" | ||
6 | dir_ipconf="/var/run/service/fw" | ||
7 | |||
8 | # Reconfigure network with this interface disabled | ||
9 | echo "Finish: deconfiguring" | ||
10 | rm "env.out" | ||
11 | rm "$file_ipconf" | ||
12 | rm "$dir_ipconf/$file_ipconf" | ||
13 | sv u /var/service/fw | ||
diff --git a/examples/var_service/zcip_if/log/run b/examples/var_service/zcip_if/log/run index 560d1b19f..69d74b73f 100755 --- a/examples/var_service/zcip_if/log/run +++ b/examples/var_service/zcip_if/log/run | |||
@@ -6,7 +6,7 @@ logdir="/var/log/service/`(cd ..;basename $PWD)`" | |||
6 | mkdir -p "$logdir" 2>/dev/null | 6 | mkdir -p "$logdir" 2>/dev/null |
7 | chown -R "$user": "$logdir" | 7 | chown -R "$user": "$logdir" |
8 | chmod -R go-rwxst,u+rwX "$logdir" | 8 | chmod -R go-rwxst,u+rwX "$logdir" |
9 | rm logdir | 9 | rm -rf logdir |
10 | ln -s "$logdir" logdir | 10 | ln -s "$logdir" logdir |
11 | 11 | ||
12 | # make this dir accessible to logger | 12 | # make this dir accessible to logger |
diff --git a/examples/var_service/zcip_if/zcip_handler b/examples/var_service/zcip_if/zcip_handler index 13010db27..3c6ca788b 100755 --- a/examples/var_service/zcip_if/zcip_handler +++ b/examples/var_service/zcip_if/zcip_handler | |||
@@ -33,7 +33,8 @@ if test x"$1" != x"config"; then | |||
33 | fi | 33 | fi |
34 | 34 | ||
35 | # "config": we've got the address | 35 | # "config": we've got the address |
36 | #env # debug | 36 | # Record information for e.g. dhcp_$IF_pinger service |
37 | env >"env.out" | ||
37 | 38 | ||
38 | ./convert2ipconf "$file_ipconf" | 39 | ./convert2ipconf "$file_ipconf" |
39 | # Reconfigure routing and firewall if needed | 40 | # Reconfigure routing and firewall if needed |