]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Drop use of ctdb_check_counter from vsftpd event script
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 05:06:24 +0000 (15:06 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:25 +0000 (02:24 +0200)
This makes the logic more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events.d/40.vsftpd

index cdc99830bebb4a1ddc5460d4c61a50e482934c74..2b8cddef8e4bd3dd9ec309f91275112fdd82e4ff 100755 (executable)
@@ -23,8 +23,6 @@ service_reconfigure ()
     service $service_name restart
 }
 
-service_fail_limit=2
-
 loadconfig
 
 ctdb_start_stop_service
@@ -51,9 +49,12 @@ monitor)
                ctdb_counter_init
        else
                ctdb_counter_incr
-               ctdb_check_counter
-               ctdb_check_counter "quiet" -ge 1 || \
-                   echo "WARNING: vsftpd not listening but less than $service_fail_limit consecutive failures, not unhealthy yet"
+               num_fails=$(ctdb_counter_get)
+               if [ "$num_fails" -ge 2 ] ; then
+                       die "ERROR: ${num_fails} consecutive failures for vsftpd, marking node unhealthy"
+               elif [ "$num_fails" -eq 1 ] ; then
+                       echo "WARNING: vsftpd not listening but less than 2 consecutive failures, not unhealthy yet"
+               fi
        fi
        ;;
 esac