3
##############################
4
# init info for redhat distros
6
# description: Starts and stops the clustered tdb daemon
7
# pidfile: /var/run/ctdbd/ctdbd.pid
8
##############################
10
##############################
11
# SLES/OpenSuSE init info
14
# Required-Start: $network
18
# Description: initscript for the ctdb service
21
# Source function library.
22
if [ -f /etc/init.d/functions ] ; then
23
. /etc/init.d/functions
24
elif [ -f /etc/rc.d/init.d/functions ] ; then
25
. /etc/rc.d/init.d/functions
28
[ -f /etc/rc.status ] && {
34
# Avoid using root's TMPDIR
37
[ -z "$CTDB_BASE" ] && {
38
export CTDB_BASE="/etc/ctdb"
41
. $CTDB_BASE/functions
45
# check networking is up (for redhat)
46
[ "${NETWORKING}" = "no" ] && exit 0
48
[ -z "$CTDB_RECOVERY_LOCK" ] && {
49
echo "You must configure the location of the CTDB_RECOVERY_LOCK"
52
CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
54
# build up CTDB_OPTIONS variable from optional parameters
55
[ -z "$CTDB_LOGFILE" ] || CTDB_OPTIONS="$CTDB_OPTIONS --logfile=$CTDB_LOGFILE"
56
[ -z "$CTDB_NODES" ] || CTDB_OPTIONS="$CTDB_OPTIONS --nlist=$CTDB_NODES"
57
[ -z "$CTDB_SOCKET" ] || CTDB_OPTIONS="$CTDB_OPTIONS --socket=$CTDB_SOCKET"
58
[ -z "$CTDB_PUBLIC_ADDRESSES" ] || CTDB_OPTIONS="$CTDB_OPTIONS --public-addresses=$CTDB_PUBLIC_ADDRESSES"
59
[ -z "$CTDB_PUBLIC_INTERFACE" ] || CTDB_OPTIONS="$CTDB_OPTIONS --public-interface=$CTDB_PUBLIC_INTERFACE"
60
[ -z "$CTDB_SINGLE_PUBLIC_IP" ] || CTDB_OPTIONS="$CTDB_OPTIONS --single-public-ip=$CTDB_SINGLE_PUBLIC_IP"
61
[ -z "$CTDB_DBDIR" ] || CTDB_OPTIONS="$CTDB_OPTIONS --dbdir=$CTDB_DBDIR"
62
[ -z "$CTDB_DBDIR_PERSISTENT" ] || CTDB_OPTIONS="$CTDB_OPTIONS --dbdir-persistent=$CTDB_DBDIR_PERSISTENT"
63
[ -z "$CTDB_EVENT_SCRIPT_DIR" ] || CTDB_OPTIONS="$CTDB_OPTIONS --event-script-dir $CTDB_EVENT_SCRIPT_DIR"
64
[ -z "$CTDB_TRANSPORT" ] || CTDB_OPTIONS="$CTDB_OPTIONS --transport $CTDB_TRANSPORT"
65
[ -z "$CTDB_DEBUGLEVEL" ] || CTDB_OPTIONS="$CTDB_OPTIONS -d $CTDB_DEBUGLEVEL"
66
[ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || {
67
CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
70
if [ -x /sbin/startproc ]; then
72
else if [ -x /sbin/start-stop-daemon ]; then
81
echo -n $"Starting ctdbd service: "
84
startproc /usr/sbin/ctdbd $CTDB_OPTIONS
89
daemon ctdbd $CTDB_OPTIONS
92
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
95
start-stop-daemon --start --quiet --background --exec /usr/sbin/ctdbd -- $CTDB_OPTIONS
101
# set any tunables from the config file
102
set | grep ^CTDB_SET_ | cut -d_ -f3- |
104
varname=`echo $v | cut -d= -f1`
105
value=`echo $v | cut -d= -f2`
106
ctdb setvar $varname $value || RETVAL=1
113
echo -n $"Shutting down ctdbd service: "
117
while killall -q -0 ctdbd; do
119
count=`expr $count + 1`
120
[ $count -gt 10 ] && {
121
echo -n $"killing ctdbd "
123
pkill -9 -f $CTDB_BASE/events.d/
132
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ctdb
163
ctdb status > /dev/null && restart || :
166
# used from cron to auto-restart ctdb
167
ctdb status > /dev/null || restart
170
echo $"Usage: $0 {start|stop|restart|status|cron|condrestart}"