summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-07-11 11:02:54 +1000
committerAmitay Isaacs <amitay@samba.org>2015-07-14 09:57:18 +0200
commitdfeb5b84fd2953a5f038897073c8f10861bb00c8 (patch)
tree215faf3cbac90e86b3fd670ea6c10b1919681b56 /ctdb
parent9f4f1c51fc58b38f483802a99560bb780264519c (diff)
downloadsamba-dfeb5b84fd2953a5f038897073c8f10861bb00c8.tar.gz
ctdb-scripts: Factor out new function ctdb_counter_get()
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 4b4ac7fc206..1b9b5c441d0 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -1006,15 +1006,19 @@ ctdb_counter_incr () {
# unary counting!
echo -n 1 >> "$_counter_file"
}
+ctdb_counter_get () {
+ _ctdb_counter_common "$1"
+ # unary counting!
+ stat -c "%s" "$_counter_file" 2>/dev/null || echo 0
+}
ctdb_check_counter () {
_msg="${1:-error}" # "error" - anything else is silent on fail
_op="${2:--ge}" # an integer operator supported by test
_limit="${3:-${service_fail_limit}}"
shift 3
- _ctdb_counter_common "$1"
- # unary counting!
- _size=$(stat -c "%s" "$_counter_file" 2>/dev/null || echo 0)
+ _size=$(ctdb_counter_get "$1")
+
_hit=false
if [ "$_op" != "%" ] ; then
if [ $_size $_op $_limit ] ; then