2021-01-27 23:24:15 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
lastcond="0"
|
|
|
|
while [ true ]
|
|
|
|
do
|
|
|
|
echo "$lastping"
|
|
|
|
# Edit this setting to your server ip
|
2021-02-25 22:36:41 +01:00
|
|
|
ping -c 1 192.168.178.7
|
|
|
|
lastping1="$?"
|
|
|
|
ping -c 1 192.168.178.8
|
|
|
|
lastping2="$?"
|
|
|
|
ping -c 1 192.168.178.3
|
|
|
|
lastping3="$?"
|
2021-01-27 23:24:15 +01:00
|
|
|
|
2021-02-25 22:36:41 +01:00
|
|
|
nodesonline=$((4-$lastping1-$lastping2-$lastping3))
|
2021-01-27 23:24:15 +01:00
|
|
|
|
2021-02-25 22:36:41 +01:00
|
|
|
|
|
|
|
if [ "$lastcond" != "$nodesonline" ]
|
2021-01-27 23:24:15 +01:00
|
|
|
then
|
2021-02-25 22:36:41 +01:00
|
|
|
pvecm expected $nodesonline
|
|
|
|
lastcond=$nodesonline
|
2021-01-27 23:24:15 +01:00
|
|
|
fi
|
|
|
|
|
2021-02-25 22:36:41 +01:00
|
|
|
#echo $nodesonline
|
2021-01-27 23:24:15 +01:00
|
|
|
sleep 15
|
|
|
|
done
|