mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
fix S41netwatch script
This commit is contained in:
parent
956d7d0b2a
commit
73d18832cb
@ -7,7 +7,9 @@ netwatch_interval=20
|
||||
|
||||
test -f $watch_conf && source $watch_conf || exit 0
|
||||
|
||||
test -z "$netwatch_host" || -z "$netwatch_port" && exit 0
|
||||
if [ -z "$netwatch_host" ] || [ -z "$netwatch_port" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
test -n "$os_debug" || source /etc/init.d/conf
|
||||
@ -18,10 +20,12 @@ watch() {
|
||||
count=0
|
||||
netwatch_retries=$(($netwatch_retries - 1))
|
||||
while true; do
|
||||
sleep $netwatch_interval
|
||||
if nc -z -w $netwatch_timeout $netwatch_host $netwatch_port </dev/null >/dev/null 2>&1; then
|
||||
count=0
|
||||
else
|
||||
if [ $count -lt $netwatch_retries ]; then
|
||||
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port"
|
||||
count=$(($count + 1))
|
||||
continue
|
||||
else
|
||||
@ -29,7 +33,6 @@ watch() {
|
||||
reboot
|
||||
fi
|
||||
fi
|
||||
sleep $netwatch_interval
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user