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"
45 load_system_config
"network"
47 # check networking is up (for redhat)
48 if [ "$NETWORKING" = "no" ] ; then
52 load_system_config
"ctdb"
55 export CTDB_INIT_STYLE
57 ctdbd
="${CTDBD:-/usr/sbin/ctdbd}"
58 ctdb
="${CTDB:-/usr/bin/ctdb}"
59 pidfile
="/var/run/ctdb/ctdbd.pid"
61 ############################################################
65 printf "Starting ctdbd service: "
67 case "$CTDB_INIT_STYLE" in
73 daemon
--pidfile "$pidfile" "$ctdbd"
76 [ $RETVAL -eq 0 ] && touch /var
/lock
/subsys
/ctdb || RETVAL
=1
80 eval start-stop-daemon
--start --quiet --background --exec "$ctdbd"
87 printf "Shutting down ctdbd service: "
89 case "$CTDB_INIT_STYLE" in
97 # Common idiom in Red Hat init scripts - success() always
98 # succeeds so this does behave like if-then-else
99 # shellcheck disable=SC2015
100 [ $RETVAL -eq 0 ] && success || failure
102 [ $RETVAL -eq 0 ] && rm -f /var
/lock
/subsys
/ctdb
120 case "$CTDB_INIT_STYLE" in
122 checkproc
-p "$pidfile" "$ctdbd"
126 status
-p "$pidfile" -l "ctdb" "$ctdbd"
129 status_of_proc
-p "$pidfile" "$ctdbd" "ctdb"
134 ############################################################
143 restart|reload|force-reload
)
149 condrestart|try-restart
)
150 if check_status
>/dev
/null
; then
155 # used from cron to auto-restart ctdb
156 check_status
>/dev
/null
2>&1 || restart
159 echo "Usage: $0 {start|stop|restart|reload|force-reload|status|cron|condrestart|try-restart}"