Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/examples/var_service
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (8 years ago)
- Location:
- branches/3.3
- Files:
-
- 24 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/convert2ntpconf
r2725 r3621 30 30 for n in $ntpsrv; do 31 31 echo "let cfg=cfg+1" 32 echo "ntpip[\$cfg]='$n'" ;32 echo "ntpip[\$cfg]='$n'" 33 33 done 34 34 } >"$1" -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/dhcp_handler
r2725 r3621 37 37 file_ntpconf="$service.ntpconf" 38 38 dir_ipconf="/var/run/service/fw" 39 dir_ntpconf="/var/run/service/ntp "39 dir_ntpconf="/var/run/service/ntpd" 40 40 41 41 exec >/dev/null … … 48 48 # Reconfigure network with this interface disabled 49 49 echo "Deconfiguring" 50 rm " $service.out"50 rm "env.out" 51 51 rm "$file_ipconf" 52 52 rm "$file_ntpconf" … … 58 58 59 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 63 ./convert2ipconf "$file_ipconf" … … 70 71 fi 71 72 72 if test -d /var/service/ntp ; then73 if test -d /var/service/ntpd; then 73 74 ./convert2ntpconf "$file_ntpconf" 74 75 # Reconfigure ntp server addresses if needed … … 78 79 mkdir -p "$dir_ntpconf" 2>/dev/null 79 80 cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" 80 sv t /var/service/ntp 81 sv u /var/service/ntp 81 sv t /var/service/ntpd 82 sv u /var/service/ntpd 82 83 fi 83 84 fi -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if_pinger/run
r2725 r3621 1 1 #!/bin/sh 2 2 3 delay=67 4 3 # How often to test, seconds 4 ping_time=67 5 # "One ping, must have reply in 1 sec" 6 ping_opts="-c1 -W1 -w1" 7 # If ping failed, how soon to retry 8 retry_time=5 9 # Reinit after this many consecutive ping error 10 max_fail=5 11 # Interface whose DHCP data to use 5 12 if=${PWD##*/dhcp_} 6 13 if=${if%%_pinger} 14 15 msg() { 16 echo "`date '+%Y-%m-%d %H:%M:%S'` $*" >>"$0.log" 17 } 7 18 8 19 if test -f "$0.log"; then … … 11 22 fi 12 23 13 test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$delay" 14 . "/var/service/dhcp_$if/dhcp_$if.out" 15 test x"$router" != x"" || exec env - sleep "$delay" 24 test -f "/var/service/dhcp_$if/env.out" || exec env - sleep "$ping_time" 16 25 17 #echo "`date '+%Y-%m-%d %H:%M:%S'` Testing ping -c3 $router" >>"$0.log"18 ping -c3 "$router" && exec env - sleep "$delay"26 . "/var/service/dhcp_$if/env.out" 27 test x"$router" != x"" || exec env - sleep "$ping_time" 19 28 20 echo "`date '+%Y-%m-%d %H:%M:%S'` Restarting /var/service/dhcp_$if" >>"$0.log" 21 sv t "/var/service/dhcp_$if" 29 #msg "Pinging $router" 30 failcnt=0 31 while true; do 32 ping $ping_opts "$router" && exec env - sleep "$ping_time" 33 : $((failcnt++)) 34 msg "Failed to ping $router, fail count:$failcnt" 35 test $failcnt -ge $max_fail && break 36 env - sleep "$retry_time" 37 done 22 38 23 exec env - sleep "$delay" 39 test -d "/var/service/dhcp_$if" && { 40 msg "Restarting /var/service/dhcp_$if" 41 sv t "/var/service/dhcp_$if" 42 } 43 test -d "/var/service/supplicant_$if" && { 44 msg "Restarting /var/service/supplicant_$if" 45 sv t "/var/service/supplicant_$if" 46 } 47 exec env - sleep "$ping_time" -
branches/3.3/mindi-busybox/examples/var_service/ftpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/fw/run
r2725 r3621 63 63 # Make sure rundir/ exists 64 64 mkdir -p "$rundir" 2>/dev/null 65 chown -R "$user :""$rundir"65 chown -R "$user": "$rundir" 66 66 chmod -R a=rX "$rundir" 67 67 rm -rf rundir 2>/dev/null -
branches/3.3/mindi-busybox/examples/var_service/httpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ifplugd_if/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ifplugd_if/run
r2725 r3621 8 8 9 9 if="${PWD##*/ifplugd_}" 10 11 echo "* Upping iface $if" 12 ip link set dev "$if" up 10 13 11 14 echo "* Starting ifplugd on $if [$$]" -
branches/3.3/mindi-busybox/examples/var_service/inetd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ntpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ntpd/ntp.script
r2725 r3621 11 11 dt=`date '+%Y-%m-%d %H:%M:%S'` 12 12 13 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$" 14 15 if test x"$1" = x"unsync" \ 16 ; then 17 # No replies for our NTP requests were seen for some time. 18 # 19 # Among more mundate cases like network outages, this happens 20 # if we ran for a LONG time (days) and ntp server's IP has changed. 21 # ntpd has no code to re-resolve peers' addresses to IPs, 22 # we need to help it: 23 # 24 echo "$dt: $1"\ 25 "syncronization lost, restarting ntpd"\ 26 >>"$0.log.$$" 27 mv -- "$0.log.$$" "$0.log" 28 kill $PPID 29 exit 30 fi 31 13 32 if test x"$stratum" != x"" \ 14 33 && test x"$poll_interval" != x"" \ … … 16 35 && test 128 -le "$poll_interval" \ 17 36 ; then 18 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"19 37 echo "$dt: $1"\ 20 38 "freq_drift_ppm=$freq_drift_ppm"\ … … 28 46 fi 29 47 30 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"31 48 echo "$dt: $1"\ 32 49 "freq_drift_ppm=$freq_drift_ppm"\ -
branches/3.3/mindi-busybox/examples/var_service/ntpd/run
r2725 r3621 16 16 # Make sure rundir/ exists 17 17 mkdir -p "$rundir" 2>/dev/null 18 chown -R "$user :""$rundir"18 chown -R "$user": "$rundir" 19 19 chmod -R a=rX "$rundir" 20 20 rm -rf rundir 2>/dev/null -
branches/3.3/mindi-busybox/examples/var_service/tftpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11
Note:
See TracChangeset
for help on using the changeset viewer.