1 # Hey Emacs, this is a -*- shell-script -*- !!!
3 # utility functions for ctdb event scripts
5 if [ -z "$CTDB_BASE" ] ; then
6 echo 'CTDB_BASE unset in CTDB functions file'
10 CTDB_VARDIR="/usr/local/var/lib/ctdb"
12 # Only (and always) override these variables in test code
14 if [ -z "$CTDB_SCRIPT_VARDIR" ] ; then
15 CTDB_SCRIPT_VARDIR="/usr/local/var/lib/ctdb/state"
18 if [ -z "$CTDB_SYS_ETCDIR" ] ; then
19 CTDB_SYS_ETCDIR="/etc"
22 #######################################
23 # pull in a system config file, if any
27 foo="${service_config:-${service_name}}"
28 if [ -n "$foo" ] ; then
34 if [ "$1" != "ctdb" ] ; then
42 if [ -f $CTDB_SYS_ETCDIR/sysconfig/$1 ]; then
43 . $CTDB_SYS_ETCDIR/sysconfig/$1
44 elif [ -f $CTDB_SYS_ETCDIR/default/$1 ]; then
45 . $CTDB_SYS_ETCDIR/default/$1
46 elif [ -f $CTDB_BASE/sysconfig/$1 ]; then
47 . $CTDB_BASE/sysconfig/$1
50 if [ "$1" = "ctdb" ] ; then
51 _config="${CTDB_BASE}/ctdbd.conf"
52 if [ -r "$_config" ] ; then
62 ##############################################################
64 # CTDB_SCRIPT_DEBUGLEVEL can be overwritten by setting it in a
68 if [ ${CTDB_SCRIPT_DEBUGLEVEL:-2} -ge 4 ] ; then
69 # If there are arguments then echo them. Otherwise expect to
70 # use stdin, which allows us to pass lots of debug using a
93 # Log given message or stdin to either syslog or a CTDB log file
94 # $1 is the tag passed to logger if syslog is in use.
99 case "$CTDB_LOGGING" in
101 if [ -n "$CTDB_LOGGING" ] ; then
102 _file="${CTDB_LOGGING#file:}"
104 _file="/usr/local/var/log/log.ctdb"
107 if [ -n "$*" ] ; then
115 # Handle all syslog:* variants here too. There's no tool to do
116 # the lossy things, so just use logger.
117 logger -t "ctdbd: ${_tag}" $*
122 # When things are run in the background in an eventscript then logging
123 # output might get lost. This is the "solution". :-)
124 background_with_logging ()
127 "$@" 2>&1 </dev/null |
128 script_log "${script_name}&"
134 ##############################################################
135 # check number of args for different events
141 echo "ERROR: must supply interface, IP and maskbits"
147 echo "ERROR: must supply old interface, new interface, IP and maskbits"
154 ##############################################################
155 # determine on what type of system (init style) we are running
158 # only do detection if not already set:
159 [ -z "$CTDB_INIT_STYLE" ] || return
161 if [ -x /sbin/startproc ]; then
162 CTDB_INIT_STYLE="suse"
163 elif [ -x /sbin/start-stop-daemon ]; then
164 CTDB_INIT_STYLE="debian"
166 CTDB_INIT_STYLE="redhat"
170 ######################################################
171 # simulate /sbin/service on platforms that don't have it
172 # _service() makes it easier to hook the service() function for
179 # do nothing, when no service was specified
180 [ -z "$_service_name" ] && return
182 if [ -x /sbin/service ]; then
183 $_nice /sbin/service "$_service_name" "$_op"
184 elif [ -x /usr/sbin/service ]; then
185 $_nice /usr/sbin/service "$_service_name" "$_op"
186 elif [ -x $CTDB_SYS_ETCDIR/init.d/$_service_name ]; then
187 $_nice $CTDB_SYS_ETCDIR/init.d/$_service_name "$_op"
188 elif [ -x $CTDB_SYS_ETCDIR/rc.d/init.d/$_service_name ]; then
189 $_nice $CTDB_SYS_ETCDIR/rc.d/init.d/$_service_name "$_op"
199 ######################################################
200 # simulate /sbin/service (niced) on platforms that don't have it
207 ######################################################
208 # Cached retrieval of PNN from local node. This never changes so why
209 # open a client connection to the server each time this is needed?
210 # This sets $pnn - this avoid an unnecessary subprocess.
213 _pnn_file="${CTDB_SCRIPT_VARDIR}/my-pnn"
214 if [ ! -f "$_pnn_file" ] ; then
215 ctdb pnn | sed -e 's@.*:@@' >"$_pnn_file"
218 read pnn <"$_pnn_file"
221 ######################################################
222 # wrapper around /proc/ settings to allow them to be hooked
224 # 1st arg is relative path under /proc/, 2nd arg is value to set
227 echo "$2" >"/proc/$1"
232 if [ -w "/proc/$1" ] ; then
237 ######################################################
238 # wrapper around getting file contents from /proc/ to allow
239 # this to be hooked for testing
240 # 1st arg is relative path under /proc/
246 ######################################################
247 # Print up to $_max kernel stack traces for processes named $_program
248 program_stack_traces ()
254 for _pid in $(pidof "$_prog") ; do
255 [ $_count -le $_max ] || break
257 # Do this first to avoid racing with process exit
258 _stack=$(get_proc "${_pid}/stack" 2>/dev/null)
259 if [ -n "$_stack" ] ; then
260 echo "Stack trace for ${_prog}[${_pid}]:"
262 _count=$(($_count + 1))
267 ######################################################
268 # Ensure $service_name is set
269 assert_service_name ()
271 [ -n "$service_name" ] || die "INTERNAL ERROR: \$service_name not set"
274 ######################################################
275 # check a set of directories is available
276 # return 1 on a missing directory
277 # directories are read from stdin
278 ######################################################
279 ctdb_check_directories_probe()
281 while IFS="" read d ; do
287 [ -d "${d}/." ] || return 1
292 ######################################################
293 # check a set of directories is available
294 # directories are read from stdin
295 ######################################################
296 ctdb_check_directories()
298 ctdb_check_directories_probe || {
299 echo "ERROR: $service_name directory \"$d\" not available"
304 ######################################################
305 # check a set of tcp ports
306 # usage: ctdb_check_tcp_ports <ports...>
307 ######################################################
309 # This flag file is created when a service is initially started. It
310 # is deleted the first time TCP port checks for that service succeed.
311 # Until then ctdb_check_tcp_ports() prints a more subtle "error"
312 # message if a port check fails.
313 _ctdb_check_tcp_common ()
316 _d="${CTDB_SCRIPT_VARDIR}/failcount"
317 _ctdb_service_started_file="${_d}/${service_name}.started"
320 ctdb_check_tcp_init ()
322 _ctdb_check_tcp_common
323 mkdir -p "${_ctdb_service_started_file%/*}" # dirname
324 touch "$_ctdb_service_started_file"
327 # Check whether something is listening on all of the given TCP ports
328 # using the "ctdb checktcpport" command.
329 ctdb_check_tcp_ports()
331 if [ -z "$1" ] ; then
332 echo "INTERNAL ERROR: ctdb_check_tcp_ports - no ports specified"
336 for _p ; do # process each function argument (port)
337 _cmd="ctdb checktcpport $_p"
342 _ctdb_check_tcp_common
343 if [ ! -f "$_ctdb_service_started_file" ] ; then
344 echo "ERROR: $service_name tcp port $_p is not responding"
345 debug "\"ctdb checktcpport $_p\" was able to bind to port"
347 echo "INFO: $service_name tcp port $_p is not responding"
353 # Couldn't bind, something already listening, next port...
357 echo "ERROR: unexpected error running \"ctdb checktcpport\""
359 ctdb checktcpport (exited with $_ret) with output:
366 # All ports listening
367 _ctdb_check_tcp_common
368 rm -f "$_ctdb_service_started_file"
372 ######################################################
373 # check a unix socket
374 # usage: ctdb_check_unix_socket SERVICE_NAME <socket_path>
375 ######################################################
376 ctdb_check_unix_socket() {
378 [ -z "$socket_path" ] && return
380 if ! netstat --unix -a -n | grep -q "^unix.*LISTEN.*${socket_path}$"; then
381 echo "ERROR: $service_name socket $socket_path not found"
386 ######################################################
387 # check a command returns zero status
388 # usage: ctdb_check_command <command>
389 ######################################################
390 ctdb_check_command ()
392 _out=$("$@" 2>&1) || {
393 echo "ERROR: $* returned error"
399 ################################################
400 # kill off any TCP connections with the given IP
401 ################################################
402 kill_tcp_connections ()
407 if [ "$2" = "oneway" ] ; then
411 get_tcp_connections_for_ip "$_ip" | {
416 while read _dst _src; do
417 _destport="${_dst##*:}"
420 # we only do one-way killtcp for CIFS
421 139|445) __oneway=true ;;
424 echo "Killing TCP connection $_src $_dst"
425 _connections="${_connections}${_nl}${_src} ${_dst}"
426 if ! $__oneway ; then
427 _connections="${_connections}${_nl}${_dst} ${_src}"
430 _killcount=$(($_killcount + 1))
433 if [ $_killcount -eq 0 ] ; then
437 echo "$_connections" | ctdb killtcp || {
438 echo "Failed to send killtcp control"
444 _remaining=$(get_tcp_connections_for_ip $_ip | wc -l)
446 if [ $_remaining -eq 0 ] ; then
447 echo "Killed $_killcount TCP connections to released IP $_ip"
451 _count=$(($_count + 1))
452 if [ $_count -gt 3 ] ; then
453 echo "Timed out killing tcp connections for IP $_ip ($_remaining remaining)"
457 echo "Waiting for $_remaining connections to be killed for IP $_ip"
463 ##################################################################
464 # kill off the local end for any TCP connections with the given IP
465 ##################################################################
466 kill_tcp_connections_local_only ()
468 kill_tcp_connections "$1" "oneway"
471 ##################################################################
472 # tickle any TCP connections with the given IP
473 ##################################################################
474 tickle_tcp_connections ()
478 get_tcp_connections_for_ip "$_ip" |
482 while read dest src; do
483 echo "Tickle TCP connection $src $dest"
484 ctdb tickle $src $dest >/dev/null 2>&1 || _failed=true
485 echo "Tickle TCP connection $dest $src"
486 ctdb tickle $dest $src >/dev/null 2>&1 || _failed=true
490 echo "Failed to send tickle control"
495 get_tcp_connections_for_ip ()
499 netstat -tn | awk -v ip=$_ip \
500 'index($1, "tcp") == 1 && \
501 (index($4, ip ":") == 1 || index($4, "::ffff:" ip ":") == 1) \
502 && $6 == "ESTABLISHED" \
506 ########################################################
514 # Ensure interface is up
515 ip link set "$_iface" up || \
516 die "Failed to bringup interface $_iface"
518 # Only need to define broadcast for IPv4
524 ip addr add "$_ip/$_maskbits" $_bcast dev "$_iface" || {
525 echo "Failed to add $_ip/$_maskbits on dev $_iface"
529 # Wait 5 seconds for IPv6 addresses to stop being tentative...
530 if [ -z "$_bcast" ] ; then
531 for _x in $(seq 1 10) ; do
532 ip addr show to "${_ip}/128" | grep -q "tentative" || break
536 # If the address was a duplicate then it won't be on the
537 # interface so flag an error.
538 _t=$(ip addr show to "${_ip}/128")
541 echo "Failed to add $_ip/$_maskbits on dev $_iface"
544 *tentative*|*dadfailed*)
545 echo "Failed to add $_ip/$_maskbits on dev $_iface"
546 ip addr del "$_ip/$_maskbits" dev "$_iface"
553 delete_ip_from_iface()
559 # This could be set globally for all interfaces but it is probably
560 # better to avoid surprises, so limit it the interfaces where CTDB
561 # has public IP addresses. There isn't anywhere else convenient
562 # to do this so just set it each time. This is much cheaper than
563 # remembering and re-adding secondaries.
564 set_proc "sys/net/ipv4/conf/${_iface}/promote_secondaries" 1
566 ip addr del "$_ip/$_maskbits" dev "$_iface" || {
567 echo "Failed to del $_ip on dev $_iface"
572 # If the given IP is hosted then print 2 items: maskbits and iface
578 *:*) _family="inet6" ; _bits=128 ;;
579 *) _family="inet" ; _bits=32 ;;
582 ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
583 awk -v family="${_family}" \
584 'NR == 1 { iface = $2; sub(":$", "", iface) ; \
585 sub("@.*", "", iface) } \
586 $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
587 print mask, iface, family }'
592 _addr="${1%/*}" # Remove optional maskbits
594 set -- $(ip_maskbits_iface $_addr)
595 if [ -n "$1" ] ; then
598 echo "Removing public address $_addr/$_maskbits from device $_iface"
599 delete_ip_from_iface $_iface $_addr $_maskbits >/dev/null 2>&1
603 drop_all_public_ips ()
605 while read _ip _x ; do
607 done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
612 set_proc_maybe sys/net/ipv4/route/flush 1
613 set_proc_maybe sys/net/ipv6/route/flush 1
616 ########################################################
618 _ctdb_counter_common () {
619 _service_name="${1:-${service_name:-${script_name}}}"
620 _counter_file="${CTDB_SCRIPT_VARDIR}/failcount/${_service_name}"
621 mkdir -p "${_counter_file%/*}" # dirname
623 ctdb_counter_init () {
624 _ctdb_counter_common "$1"
628 ctdb_counter_incr () {
629 _ctdb_counter_common "$1"
632 echo -n 1 >> "$_counter_file"
634 ctdb_counter_get () {
635 _ctdb_counter_common "$1"
637 stat -c "%s" "$_counter_file" 2>/dev/null || echo 0
639 ctdb_check_counter () {
640 _msg="${1:-error}" # "error" - anything else is silent on fail
641 _op="${2:--ge}" # an integer operator supported by test
642 _limit="${3:-${service_fail_limit}}"
645 _size=$(ctdb_counter_get "$1")
648 if [ "$_op" != "%" ] ; then
649 if [ $_size $_op $_limit ] ; then
653 if [ $(($_size $_op $_limit)) -eq 0 ] ; then
658 if [ "$_msg" = "error" ] ; then
659 echo "ERROR: $_size consecutive failures for $_service_name, marking node unhealthy"
667 ########################################################
669 ctdb_setup_service_state_dir ()
671 service_state_dir="${CTDB_SCRIPT_VARDIR}/service_state/${1:-${service_name}}"
672 mkdir -p "$service_state_dir" || {
673 echo "Error creating state dir \"$service_state_dir\""
678 ########################################################
679 # Managed status history, for auto-start/stop
681 _ctdb_managed_common ()
683 _ctdb_managed_file="${CTDB_SCRIPT_VARDIR}/managed_history/${service_name}"
686 ctdb_service_managed ()
689 mkdir -p "${_ctdb_managed_file%/*}" # dirname
690 touch "$_ctdb_managed_file"
693 ctdb_service_unmanaged ()
696 rm -f "$_ctdb_managed_file"
699 is_ctdb_previously_managed_service ()
702 [ -f "$_ctdb_managed_file" ]
705 ##################################################################
706 # Reconfigure a service on demand
708 _ctdb_service_reconfigure_common ()
710 _d="${CTDB_SCRIPT_VARDIR}/service_status/${service_name}"
712 _ctdb_service_reconfigure_flag="$_d/reconfigure"
715 ctdb_service_needs_reconfigure ()
717 _ctdb_service_reconfigure_common
718 [ -e "$_ctdb_service_reconfigure_flag" ]
721 ctdb_service_set_reconfigure ()
723 _ctdb_service_reconfigure_common
724 >"$_ctdb_service_reconfigure_flag"
727 ctdb_service_unset_reconfigure ()
729 _ctdb_service_reconfigure_common
730 rm -f "$_ctdb_service_reconfigure_flag"
733 ctdb_service_reconfigure ()
735 echo "Reconfiguring service \"${service_name}\"..."
736 ctdb_service_unset_reconfigure
737 service_reconfigure || return $?
741 # Default service_reconfigure() function does nothing.
742 service_reconfigure ()
747 ctdb_reconfigure_take_lock ()
749 _ctdb_service_reconfigure_common
750 _lock="${_d}/reconfigure_lock"
751 mkdir -p "${_lock%/*}" # dirname
756 # This is overkill but will work if we need to extend this to
757 # allow certain events to run multiple times in parallel
758 # (e.g. takeip) and write multiple PIDs to the file.
760 if [ -n "$_locker_event" ] ; then
762 if [ -n "$_pid" -a "$_pid" != $$ ] && \
763 kill -0 "$_pid" 2>/dev/null ; then
769 printf "%s\n%s\n" "$event_name" $$ >"$_lock"
774 ctdb_reconfigure_release_lock ()
776 _ctdb_service_reconfigure_common
777 _lock="${_d}/reconfigure_lock"
782 ctdb_replay_monitor_status ()
784 echo "Replaying previous status for this script due to reconfigure..."
785 # Leading separator ('|') is missing in some versions...
786 _out=$(ctdb scriptstatus -X | grep -E "^\|?monitor\|${script_name}\|")
787 # Output looks like this:
788 # |monitor|60.nfs|1|ERROR|1314764004.030861|1314764004.035514|foo bar|
789 # This is the cheapest way of getting fields in the middle.
790 set -- $(IFS="|" ; echo $_out)
793 # The error output field can include colons so we'll try to
794 # preserve them. The weak checking at the beginning tries to make
795 # this work for both broken (no leading '|') and fixed output.
797 _err_out="${_out#*monitor|${script_name}|*|*|*|*|}"
799 OK) : ;; # Do nothing special.
801 # Recast this as an error, since we can't exit with the
802 # correct negative number.
804 _err_out="[Replay of TIMEDOUT scriptstatus - note incorrect return code.] ${_err_out}"
807 # Recast this as an OK, since we can't exit with the
808 # correct negative number.
810 _err_out="[Replay of DISABLED scriptstatus - note incorrect return code.] ${_err_out}"
812 *) : ;; # Must be ERROR, do nothing special.
814 if [ -n "$_err_out" ] ; then
820 ctdb_service_check_reconfigure ()
824 # We only care about some events in this function. For others we
826 case "$event_name" in
827 monitor|ipreallocated|reconfigure) : ;;
831 if ctdb_reconfigure_take_lock ; then
832 # No events covered by this function are running, so proceed
834 case "$event_name" in
836 (ctdb_service_reconfigure)
840 if ctdb_service_needs_reconfigure ; then
841 ctdb_service_reconfigure
846 ctdb_reconfigure_release_lock
848 # Somebody else is running an event we don't want to collide
849 # with. We proceed with caution.
850 case "$event_name" in
852 # Tell whoever called us to retry.
856 # Defer any scheduled reconfigure and just run the
857 # rest of the ipreallocated event, as per the
858 # eventscript. There's an assumption here that the
859 # event doesn't depend on any scheduled reconfigure.
860 # This is true in the current code.
864 # There is most likely a reconfigure in progress so
865 # the service is possibly unstable. As above, we
866 # defer any scheduled reconfigured. We also replay
867 # the previous monitor status since that's the best
868 # information we have.
869 ctdb_replay_monitor_status
875 ##################################################################
876 # Does CTDB manage this service? - and associated auto-start/stop
878 ctdb_compat_managed_service ()
880 if [ "$1" = "yes" -a "$2" = "$service_name" ] ; then
881 CTDB_MANAGED_SERVICES="$CTDB_MANAGED_SERVICES $2"
885 is_ctdb_managed_service ()
889 # $t is used just for readability and to allow better accurate
890 # matching via leading/trailing spaces
891 t=" $CTDB_MANAGED_SERVICES "
893 # Return 0 if "<space>$service_name<space>" appears in $t
894 if [ "${t#* ${service_name} }" != "${t}" ] ; then
898 # If above didn't match then update $CTDB_MANAGED_SERVICES for
899 # backward compatibility and try again.
900 ctdb_compat_managed_service "$CTDB_MANAGES_VSFTPD" "vsftpd"
901 ctdb_compat_managed_service "$CTDB_MANAGES_SAMBA" "samba"
902 ctdb_compat_managed_service "$CTDB_MANAGES_WINBIND" "winbind"
903 ctdb_compat_managed_service "$CTDB_MANAGES_HTTPD" "apache2"
904 ctdb_compat_managed_service "$CTDB_MANAGES_HTTPD" "httpd"
905 ctdb_compat_managed_service "$CTDB_MANAGES_ISCSI" "iscsi"
906 ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD" "clamd"
907 ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs"
909 t=" $CTDB_MANAGED_SERVICES "
911 # Return 0 if "<space>$service_name<space>" appears in $t
912 [ "${t#* ${service_name} }" != "${t}" ]
915 ctdb_start_stop_service ()
919 # Allow service-start/service-stop pseudo-events to start/stop
920 # services when we're not auto-starting/stopping and we're not
922 case "$event_name" in
924 if is_ctdb_managed_service ; then
925 die 'service-start event not permitted when service is managed'
927 if [ "$CTDB_SERVICE_AUTOSTARTSTOP" = "yes" ] ; then
928 die 'service-start event not permitted with $CTDB_SERVICE_AUTOSTARTSTOP = yes'
934 if is_ctdb_managed_service ; then
935 die 'service-stop event not permitted when service is managed'
937 if [ "$CTDB_SERVICE_AUTOSTARTSTOP" = "yes" ] ; then
938 die 'service-stop event not permitted with $CTDB_SERVICE_AUTOSTARTSTOP = yes'
945 # Do nothing unless configured to...
946 [ "$CTDB_SERVICE_AUTOSTARTSTOP" = "yes" ] || return 0
948 [ "$event_name" = "monitor" ] || return 0
950 if is_ctdb_managed_service ; then
951 if ! is_ctdb_previously_managed_service ; then
952 echo "Starting service \"$service_name\" - now managed"
953 background_with_logging ctdb_service_start
957 if is_ctdb_previously_managed_service ; then
958 echo "Stopping service \"$service_name\" - no longer managed"
959 background_with_logging ctdb_service_stop
965 ctdb_service_start ()
967 # The service is marked managed if we've ever tried to start it.
970 service_start || return $?
978 ctdb_service_unmanaged
982 # Default service_start() and service_stop() functions.
984 # These may be overridden in an eventscript.
987 service "$service_name" start
992 service "$service_name" stop
995 ##################################################################
997 ctdb_standard_event_handler ()
1004 _family="$1" ; shift
1005 if [ "$_family" = "inet6" ] ; then
1006 _iptables_cmd="ip6tables"
1008 _iptables_cmd="iptables"
1011 # iptables doesn't like being re-entered, so flock-wrap it.
1012 flock -w 30 "${CTDB_SCRIPT_VARDIR}/iptables.flock" "$_iptables_cmd" "$@"
1015 # AIX (and perhaps others?) doesn't have mktemp
1016 if ! type mktemp >/dev/null 2>&1 ; then
1020 if [ "$1" = "-d" ] ; then
1024 _d="${TMPDIR:-/tmp}"
1025 _hex10=$(dd if=/dev/urandom count=20 2>/dev/null | \
1027 sed -e 's@\(..........\).*@\1@')
1028 _t="${_d}/tmp.${_hex10}"
1041 ########################################################
1043 ########################################################
1049 tickledir="${CTDB_SCRIPT_VARDIR}/tickles"
1050 mkdir -p "$tickledir"
1054 # What public IPs do I hold?
1055 _ips=$(ctdb -X ip | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
1057 # IPs as a regexp choice
1058 _ipschoice="($(echo $_ips | sed -e 's/ /|/g' -e 's/\./\\\\./g'))"
1060 # Record connections to our public IPs in a temporary file
1061 _my_connections="${tickledir}/${_port}.connections"
1062 rm -f "$_my_connections"
1064 awk -v destpat="^${_ipschoice}:${_port}\$" \
1065 '$1 == "tcp" && $6 == "ESTABLISHED" && $4 ~ destpat {print $5, $4}' |
1066 sort >"$_my_connections"
1068 # Record our current tickles in a temporary file
1069 _my_tickles="${tickledir}/${_port}.tickles"
1070 rm -f "$_my_tickles"
1071 for _i in $_ips ; do
1072 ctdb -X gettickles $_i $_port |
1073 awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
1075 sort >"$_my_tickles"
1077 # Add tickles for connections that we haven't already got tickles for
1078 comm -23 "$_my_connections" "$_my_tickles" |
1079 while read _src _dst ; do
1080 ctdb addtickle $_src $_dst
1083 # Remove tickles for connections that are no longer there
1084 comm -13 "$_my_connections" "$_my_tickles" |
1085 while read _src _dst ; do
1086 ctdb deltickle $_src $_dst
1089 rm -f "$_my_connections" "$_my_tickles"
1092 ########################################################
1093 # load a site local config file
1094 ########################################################
1096 [ -n "$CTDB_RC_LOCAL" -a -x "$CTDB_RC_LOCAL" ] && {
1100 [ -x $CTDB_BASE/rc.local ] && {
1101 . $CTDB_BASE/rc.local
1104 [ -d $CTDB_BASE/rc.local.d ] && {
1105 for i in $CTDB_BASE/rc.local.d/* ; do
1106 [ -x "$i" ] && . "$i"
1110 script_name="${0##*/}" # basename
1111 service_fail_limit=1