add a new support function ctdb_check_counter_equal()
[sahlberg/ctdb.git] / config / functions
index 610085b67700feb1faad5c715df79cb506ff4cde..4acfc4ffab3f4347dce18f23be6a2e1f0e8c4be9 100755 (executable)
@@ -571,6 +571,19 @@ ctdb_check_counter_limit () {
        echo "WARNING: less than $_limit consecutive failures ($_size) for $service_name, not unhealthy yet"
     fi
 }
+ctdb_check_counter_equal () {
+    _ctdb_counter_common
+
+    _limit=$1
+
+    # unary counting!
+    _size=$(stat -c "%s" "$_counter_file" 2>/dev/null || echo 0)
+    if [ $_size -eq $_limit ] ; then
+       return 1
+    fi
+    return 0
+}
+
 ########################################################
 
 ctdb_spool_dir="/var/spool/ctdb"