Commit af5b1cf9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rewrite background for monit coexistance

parent 49ca73cd
......@@ -2,6 +2,13 @@
cd $(dirname $0)
if [ "$1" = "stop" ] ; then
echo "$(date) Watcher is stopped" >>/var/log/check_connectivity.log
kill $(cat /var/run/check_connectivity.pid)
rm -f /var/run/check_connectivity.pid
exit
fi
# ya.ru google.com
HOSTS="93.158.134.3 173.194.71.139"
......@@ -55,7 +62,11 @@ set_state_by_bgp()
[ "$SPROMETEY" = "ok" ] && NEWSTATE=prometey && return
}
main_cycle()
{
./both_provs.sh
echo "$(date) Start with both state" >>/var/log/check_connectivity.log
while true ; do
set_state
......@@ -81,8 +92,12 @@ while true ; do
;;
esac
echo "State changed to $NEWSTATE"
echo "$(date) State changed to $NEWSTATE" >>/var/log/check_connectivity.log
STATE=$NEWSTATE
fi
sleep 7
done
}
main_cycle &
echo $! >/var/run/check_connectivity.pid
#!/bin/sh
# update eepm and use eepm clean
rm -vf /var/cache/apt/*.bin
rm -vf /var/lib/apt/lists/*pkglist*
rm -vf /var/lib/apt/lists/*release*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment