From 03bb249940cd0bb85ff94b4a762aeeb399d63c63 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 25 Feb 2021 21:36:41 +0000 Subject: [PATCH] changed to accept more than one host --- who-needs-a-majority | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/who-needs-a-majority b/who-needs-a-majority index 810a6e2..5e6c53b 100755 --- a/who-needs-a-majority +++ b/who-needs-a-majority @@ -5,25 +5,22 @@ while [ true ] do echo "$lastping" # Edit this setting to your server ip -ping -c 1 192.168.178.10 -lastping="$?" +ping -c 1 192.168.178.7 +lastping1="$?" +ping -c 1 192.168.178.8 +lastping2="$?" +ping -c 1 192.168.178.3 +lastping3="$?" + +nodesonline=$((4-$lastping1-$lastping2-$lastping3)) -if [ "$lastcond" != "$lastping" ] +if [ "$lastcond" != "$nodesonline" ] then - if [ $lastping = 0 ] - then - pvecm expected 2 - lastcond="0" - else - pvecm expected 1 - lastcond="1" - fi + pvecm expected $nodesonline + lastcond=$nodesonline fi - - -echo "$lastping" -echo "$lastcond" +#echo $nodesonline sleep 15 done \ No newline at end of file