diff options
author | Martin Schwenke <martin@meltin.net> | 2012-07-05 16:27:54 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2012-07-26 21:24:15 +1000 |
commit | 4d4768ef26def4becba87c2fc6db6a1671ba7541 (patch) | |
tree | 024a361b28dd9944a4691b059a1eee5593e18695 /ctdb/config/statd-callout | |
parent | 6717698cba447ce681c7aa89fee4c3eb98f352fc (diff) | |
download | samba-4d4768ef26def4becba87c2fc6db6a1671ba7541.tar.gz |
statd-callout: Fix a bug in the calculations of $STATE
It is just meant to be even, so divided *and* multiplied by 2. Use
$(( )) to make it more readable.
While touching this code, make the related calculation a bit more
readable too.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 25d45e69f4ffc2b26061ac13038d52a353e79e61)
Diffstat (limited to 'ctdb/config/statd-callout')
-rwxr-xr-x | ctdb/config/statd-callout | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index 63fee0977a3..0e52cbade36 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -129,8 +129,7 @@ case "$1" in # We use epoch and hope the nodes are close enough in clock. # Even numbers mean service is shut down, odd numbers mean # service is started. - STATE=`date +"%s"` - STATE=`expr "$STATE" "/" "2"` + STATE=$(( $(date '+%s') / 2 * 2)) # we must also let some time pass between stopping and restarting the @@ -189,7 +188,7 @@ case "$1" in rm $CTDB_VARDIR/state/statd/ip/$IP/$CLIENT smnotify --client=$CLIENT --ip=$IP --server=$ip --stateval=$STATE smnotify --client=$CLIENT --ip=$IP --server=$NFS_HOSTNAME --stateval=$STATE - STATE=`expr "$STATE" "+" "1"` + STATE=$(($STATE + 1)) smnotify --client=$CLIENT --ip=$IP --server=$ip --stateval=$STATE smnotify --client=$CLIENT --ip=$IP --server=$NFS_HOSTNAME --stateval=$STATE done |