i`m new in bash scripting and i getting an error with my little server monitoring script
example of my script:
#!/bin/sh
s1_ats=0
while [ 1 ]; do
sleep 5
s1=`ping -c 1 xxxx.xxxx.xxxx.xxxx | grep 64 | awk '{print $1}'`
if [ "$s1" == "64" ] ; then
$s1_ats=0
else
if [ "$s1_ats" -ge "10" ] ; then
echo -e "sms" >> /root/tikrinimas
$s1_ats=0
else
let $s1_ats++
fi
fi
done
i want to make, that 1 server pinging other servers and if ping fails x times it send`s to me an sms message. this echo -e "sms" >> /root/tikrinimas is for this time, later i`ll connect an gsm device and that device will send an mesage if ping fails 10 times
in this example if else worked then after 3 ping fails it mus set s1_ats to 0 and write sms into /root/tikrinimas file, but how can i see that else wont work