initscript: Use a PID file to implement the "status" option
commit38366b6b53b5a7e06c79a874050e5015feb151ff
authorMartin Schwenke <martin@meltin.net>
Mon, 15 Apr 2013 05:18:12 +0000 (15 15:18 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 18 Apr 2013 03:22:12 +0000 (18 13:22 +1000)
tree1b9a8d0529d24c77cbefd44f201a68a0de4b9aa3
parentdcf1ac34ab9aa08bdb1fbd4d0a3a47cb9eaf5896
initscript: Use a PID file to implement the "status" option

Using "ctdb ping" and "ctdb status" is fraught with danger.  These
commands can timeout when ctdbd is running, leading callers to believe
that ctdbd is not running.  Timeouts could be increased but we would
still have to handle potential timeouts.

Everything else in the world implements the "status" option by
checking if the relevant process is running.  This change makes CTDB
do the same thing and uses standard distro functions.

This change is backward compatible in sense that a missing
/var/run/ctdb/ directory means that we don't do a PID file check but
just depend on the distro's checking method.  Therefore, if CTDB was
started with an older version of this script then "service ctdb
status" will still work.

This script does not support changing the value of CTDB_VALGRIND
between calls.  If you start with CTDB_VALGRIND=yes then you need to
check status with the same setting.  CTDB_VALGRIND is a debug
variable, so this is acceptable.

This also adds sourcing of /lib/lsb/init-functions to make the Debian
function status_of_proc() available.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit 687e2eace4f48400cf5029914f62b6ddabb85378)
ctdb/config/ctdb.init