3 # Start and stop CTDB (Clustered TDB daemon)
7 # description: Starts and stops CTDB
8 # pidfile: /var/run/ctdb/ctdbd.pid
9 # config: /etc/sysconfig/ctdb
13 # Required-Start: $local_fs $syslog $network $remote_fs
14 # Required-Stop: $local_fs $syslog $network $remote_fs
15 # Default-Start: 2 3 4 5
17 # Short-Description: start and stop ctdb service
18 # Description: Start and stop CTDB (Clustered TDB daemon)
21 # Source function library.
22 if [ -f /etc
/init.d
/functions
] ; then
24 .
/etc
/init.d
/functions
25 elif [ -f /etc
/rc.d
/init.d
/functions
] ; then
27 .
/etc
/rc.d
/init.d
/functions
28 elif [ -f /etc
/rc.status
] ; then
33 elif [ -f /lib
/lsb
/init-functions
] ; then
35 .
/lib
/lsb
/init-functions
38 # Avoid using root's TMPDIR
41 [ -n "$CTDB_BASE" ] ||
export CTDB_BASE
="/etc/ctdb"
43 .
"${CTDB_BASE}/functions"
47 # check networking is up (for redhat)
48 if [ "$NETWORKING" = "no" ] ; then
53 export CTDB_INIT_STYLE
55 ctdbd
="${CTDBD:-/usr/sbin/ctdbd}"
56 ctdbd_wrapper
="${CTDBD_WRAPPER:-/usr/sbin/ctdbd_wrapper}"
57 pidfile
="${CTDB_PIDFILE:-/var/run/ctdb/ctdbd.pid}"
59 ############################################################
63 echo -n "Starting ctdbd service: "
65 case "$CTDB_INIT_STYLE" in
68 "$ctdbd_wrapper" "$pidfile" "start"
72 daemon
--pidfile "$pidfile" \
73 "$ctdbd_wrapper" "$pidfile" "start"
76 [ $RETVAL -eq 0 ] && touch /var
/lock
/subsys
/ctdb || RETVAL
=1
80 eval start-stop-daemon
--start --quiet --background --exec \
81 "$ctdbd_wrapper" "$pidfile" "start"
88 echo -n "Shutting down ctdbd service: "
90 case "$CTDB_INIT_STYLE" in
92 "$ctdbd_wrapper" "$pidfile" "stop"
96 "$ctdbd_wrapper" "$pidfile" "stop"
98 [ $RETVAL -eq 0 ] && success || failure
100 [ $RETVAL -eq 0 ] && rm -f /var
/lock
/subsys
/ctdb
104 "$ctdbd_wrapper" "$pidfile" "stop"
118 # Backward compatibility. When we arrange to pass --pidfile to
119 # ctdbd we also create the directory that will contain it. If
120 # that directory is missing then we don't use the pidfile to check
121 # status. Note that this probably won't work if
122 # $CTDB_VALGRIND="yes" but this doesn't need full backward
123 # compatibility because it is a debug option.
124 if [ -d $
(dirname "$pidfile") ] ; then
125 _pf_opt
="-p $pidfile"
130 case "$CTDB_INIT_STYLE" in
132 checkproc
$_pf_opt "$ctdbd"
136 status
$_pf_opt -l "ctdb" "$ctdbd"
139 status_of_proc
$_pf_opt "$ctdbd" "ctdb"
144 ############################################################
153 restart|reload|force-reload
)
159 condrestart|try-restart
)
160 if check_status
>/dev
/null
; then
165 # used from cron to auto-restart ctdb
166 check_status
>/dev
/null
2>&1 || restart
169 echo "Usage: $0 {start|stop|restart|reload|force-reload|status|cron|condrestart|try-restart}"