Files
@ 4f1c48458236
Branch filter:
Location: freifunk/torian/ffluxbot/ff_reachable_check_lists.sh - annotation
4f1c48458236
2.5 KiB
text/x-sh
FF check script update to update nodes list ones a day and to include authentication files for xmpp account
a037ca46ced9 2b3313d0859c 2b3313d0859c a037ca46ced9 a037ca46ced9 a037ca46ced9 2b3313d0859c 2b3313d0859c 4f1c48458236 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 4f1c48458236 2b3313d0859c a037ca46ced9 2b3313d0859c 2b3313d0859c 2b3313d0859c a037ca46ced9 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 2b3313d0859c 4f1c48458236 2b3313d0859c 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 a037ca46ced9 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 2b3313d0859c 4f1c48458236 2b3313d0859c 2b3313d0859c 2b3313d0859c 4f1c48458236 2b3313d0859c 2b3313d0859c 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 | #!/bin/bash
# variables
timeout=2000
pingcount=2
interval=50
pathtoscript=/home/scripts
delaytime=15
jabberid=$(cat $pathtoscript/ffluxbot/JabberID.auth)
jabberpw=$(cat $pathtoscript/ffluxbot/JabberPW.auth)
#first check out of 3
#empty empty old list
cat /dev/null > $pathtoscript/ffluxbot/nodes_NOK.txt
iplist=$(awk '{print $1}' $pathtoscript/ffluxbot/FFnodes.txt)
# do the check
while IFS= read -r ip; do
#get node names
node_name=$(awk "/^$ip/ "'{print $NF}' $pathtoscript/ffluxbot/FFnodes.txt)
#Is node IP pingable
if fping6 -c $pingcount -t $timeout -i $interval "$ip" &>/dev/null; then
#do this
echo "$node_name is Pingable"
else
#Else do this
echo "$node_name Not Pingable"
echo "$ip" >> $pathtoscript/ffluxbot/nodes_NOK.txt
fi
done <<< "$iplist"
echo Â"Check 1 done"
sleep $delaytime
echo Â"Start Check 2"
cat /dev/null > $pathtoscript/ffluxbot/nodes_NOK2.txt
iplist2=$(awk '{print $1}' $pathtoscript/ffluxbot/nodes_NOK.txt)
#second check out of 3
while IFS= read -r ip2; do
node_name=$(awk "/^$ip2/ "'{print $NF}' $pathtoscript/ffluxbot/FFnodes.txt)
if fping6 -c $pingcount -t $timeout -i $interval "$ip2" &>/dev/null; then
echo "$node_name is Pingable"
else
echo "$node_name Not Pingable"
echo "$ip2" >> $pathtoscript/ffluxbot/nodes_NOK2.txt
fi
done <<< "$iplist2"
echo "Check 2 done"
sleep $delaytime
echo "Start Check 3"
cat /dev/null > $pathtoscript/ffluxbot/nodes_NOK3.txt
iplist3=$(awk '{print $1}' $pathtoscript/ffluxbot/nodes_NOK2.txt)
#last check out of 3
while IFS= read -r ip3; do
node_name=$(awk "/^$ip3/ "'{print $NF}' $pathtoscript/ffluxbot/FFnodes.txt)
if fping6 -c $pingcount -t $timeout -i $interval "$ip3" &>/dev/null; then
echo "$node_name is Pingable"
else
echo "$node_name Not Pingable"
echo "$node_name with IPV6 $ip3 is not reachable" >> $pathtoscript/ffluxbot/nodes_NOK3.txt
fi
done <<< "$iplist3"
echo "Check 3 done"
# prepare Text message
textmessage=$(cat $pathtoscript/ffluxbot/nodes_NOK3.txt)
echo "$textmessage"
# send the messages
python3 $pathtoscript/ffluxbot/send_client.py -d -j "$jabberid" -p "$jabberpw" -t fantawams@c3l.lu -m "$textmessage"
python3 $pathtoscript/ffluxbot/send_client.py -d -j "$jabberid" -p "$jabberpw" -t orimpe@c3l.lu -m "$textmessage"
# clean up
rm $pathtoscript/ffluxbot/nodes_NOK.txt
rm $pathtoscript/ffluxbot/nodes_NOK2.txt
rm $pathtoscript/ffluxbot/nodes_NOK3.txt
rm $pathtoscript/ffluxbot/FFnodes.txt
rm $pathtoscript/ffluxbot/nodes.json
rm $pathtoscript/ffluxbot/check.log
rm $pathtoscript/ffluxbot/download.log
|