auth3: only use "sam_netlogon3 winbind:trustdomain" in make_auth3_context_for_netlogon
[Samba.git] / ctdb / config / ctdb.init
blobb9c0a6deb0f45ef66c7805e2c1a90ca19f6def54
1 #!/bin/sh
3 # Start and stop CTDB (Clustered TDB daemon)
5 # chkconfig: - 90 01
7 # description: Starts and stops CTDB
8 # pidfile: /var/run/ctdb/ctdbd.pid
9 # config: /etc/sysconfig/ctdb
11 ### BEGIN INIT INFO
12 # Provides: 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
16 # Default-Stop: 0 1 6
17 # Short-Description: start and stop ctdb service
18 # Description: Start and stop CTDB (Clustered TDB daemon)
19 ### END INIT INFO
21 # Source function library.
22 if [ -f /etc/init.d/functions ] ; then
23 # Red Hat
24 . /etc/init.d/functions
25 elif [ -f /etc/rc.d/init.d/functions ] ; then
26 # Red Hat
27 . /etc/rc.d/init.d/functions
28 elif [ -f /etc/rc.status ] ; then
29 # SUSE
30 . /etc/rc.status
31 rc_reset
32 LC_ALL=en_US.UTF-8
33 elif [ -f /lib/lsb/init-functions ] ; then
34 # Debian
35 . /lib/lsb/init-functions
38 # Avoid using root's TMPDIR
39 unset TMPDIR
41 [ -n "$CTDB_BASE" ] || export CTDB_BASE="/etc/ctdb"
43 . "${CTDB_BASE}/functions"
44 loadconfig "network"
45 loadconfig "ctdb"
47 # check networking is up (for redhat)
48 if [ "$NETWORKING" = "no" ] ; then
49 exit 0
52 detect_init_style
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 ############################################################
61 start()
63 printf "Starting ctdbd service: "
65 case "$CTDB_INIT_STYLE" in
66 suse)
67 startproc \
68 "$ctdbd_wrapper" "$pidfile" "start"
69 rc_status -v
71 redhat)
72 daemon --pidfile "$pidfile" \
73 "$ctdbd_wrapper" "$pidfile" "start"
74 RETVAL=$?
75 echo
76 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
77 return $RETVAL
79 debian)
80 eval start-stop-daemon --start --quiet --background --exec \
81 "$ctdbd_wrapper" "$pidfile" "start"
83 esac
86 stop()
88 printf "Shutting down ctdbd service: "
90 case "$CTDB_INIT_STYLE" in
91 suse)
92 "$ctdbd_wrapper" "$pidfile" "stop"
93 rc_status -v
95 redhat)
96 "$ctdbd_wrapper" "$pidfile" "stop"
97 RETVAL=$?
98 # Common idiom in Red Hat init scripts - success() always
99 # succeeds so this does behave like if-then-else
100 # shellcheck disable=SC2015
101 [ $RETVAL -eq 0 ] && success || failure
102 echo ""
103 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ctdb
104 return $RETVAL
106 debian)
107 "$ctdbd_wrapper" "$pidfile" "stop"
108 log_end_msg $?
110 esac
113 restart()
115 stop
116 start
119 check_status ()
121 # Backward compatibility. When we arrange to pass --pidfile to
122 # ctdbd we also create the directory that will contain it. If
123 # that directory is missing then we don't use the pidfile to check
124 # status. Note that this probably won't work if
125 # $CTDB_VALGRIND="yes" but this doesn't need full backward
126 # compatibility because it is a debug option.
127 _d=$(dirname "$pidfile")
128 if [ -d "$_d" ] ; then
129 _pf_opt="-p $pidfile"
130 else
131 _pf_opt=""
134 case "$CTDB_INIT_STYLE" in
135 suse)
136 checkproc $_pf_opt "$ctdbd"
137 rc_status -v
139 redhat)
140 status $_pf_opt -l "ctdb" "$ctdbd"
142 debian)
143 status_of_proc $_pf_opt "$ctdbd" "ctdb"
145 esac
148 ############################################################
150 case "$1" in
151 start)
152 start
154 stop)
155 stop
157 restart|reload|force-reload)
158 restart
160 status)
161 check_status
163 condrestart|try-restart)
164 if check_status >/dev/null ; then
165 restart
168 cron)
169 # used from cron to auto-restart ctdb
170 check_status >/dev/null 2>&1 || restart
173 echo "Usage: $0 {start|stop|restart|reload|force-reload|status|cron|condrestart|try-restart}"
174 exit 1
175 esac