initscript: Use a PID file to implement the "status" option
authorMartin Schwenke <martin@meltin.net>
Mon, 15 Apr 2013 05:18:12 +0000 (15:18 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 18 Apr 2013 03:22:12 +0000 (13:22 +1000)
commit687e2eace4f48400cf5029914f62b6ddabb85378
tree8234976abb1d345418ab41a8ca58e7187151a708
parent996e74d3db0c50f91b320af8ab7c43ea6b1136af
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>
config/ctdb.init