From 3a79f01e5884c8a9de61988c03b2121b5d1de8d4 Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 27 Jan 2021 22:24:15 +0000 Subject: [PATCH] Well was not that complicated --- who-needs-a-majority | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 who-needs-a-majority diff --git a/who-needs-a-majority b/who-needs-a-majority new file mode 100755 index 0000000..810a6e2 --- /dev/null +++ b/who-needs-a-majority @@ -0,0 +1,29 @@ +#!/bin/bash + +lastcond="0" +while [ true ] +do +echo "$lastping" +# Edit this setting to your server ip +ping -c 1 192.168.178.10 +lastping="$?" + + +if [ "$lastcond" != "$lastping" ] +then + if [ $lastping = 0 ] + then + pvecm expected 2 + lastcond="0" + else + pvecm expected 1 + lastcond="1" + fi +fi + + + +echo "$lastping" +echo "$lastcond" +sleep 15 +done \ No newline at end of file