mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 15:54:56 +00:00
24 lines
571 B
Bash
Executable File
24 lines
571 B
Bash
Executable File
#!/bin/sh
|
|
|
|
delay=67
|
|
|
|
if=${PWD##*/dhcp_}
|
|
if=${if%%_pinger}
|
|
|
|
if test -f "$0.log"; then
|
|
tail -999 "$0.log" >"$0.log.new"
|
|
mv "$0.log.new" "$0.log"
|
|
fi
|
|
|
|
test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$delay"
|
|
. "/var/service/dhcp_$if/dhcp_$if.out"
|
|
test x"$router" != x"" || exec env - sleep "$delay"
|
|
|
|
#echo "`date '+%Y-%m-%d %H:%M:%S'` Testing ping -c3 $router" >>"$0.log"
|
|
ping -c3 "$router" && exec env - sleep "$delay"
|
|
|
|
echo "`date '+%Y-%m-%d %H:%M:%S'` Restarting /var/service/dhcp_$if" >>"$0.log"
|
|
sv t "/var/service/dhcp_$if"
|
|
|
|
exec env - sleep "$delay"
|