3
0

run 571 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. delay=67
  3. if=${PWD##*/dhcp_}
  4. if=${if%%_pinger}
  5. if test -f "$0.log"; then
  6. tail -999 "$0.log" >"$0.log.new"
  7. mv "$0.log.new" "$0.log"
  8. fi
  9. test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$delay"
  10. . "/var/service/dhcp_$if/dhcp_$if.out"
  11. test x"$router" != x"" || exec env - sleep "$delay"
  12. #echo "`date '+%Y-%m-%d %H:%M:%S'` Testing ping -c3 $router" >>"$0.log"
  13. ping -c3 "$router" && exec env - sleep "$delay"
  14. echo "`date '+%Y-%m-%d %H:%M:%S'` Restarting /var/service/dhcp_$if" >>"$0.log"
  15. sv t "/var/service/dhcp_$if"
  16. exec env - sleep "$delay"