From: Martin Schwenke Date: Wed, 6 Jul 2016 04:44:14 +0000 (+1000) Subject: ctdb-scripts: Event script indentation and whitespace cleanups X-Git-Tag: tdb-1.3.10~281 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09a7a7854ea36056c7bd09cf832d58398492adc1;p=thirdparty%2Fsamba.git ctdb-scripts: Event script indentation and whitespace cleanups * Re-indent case labels as per new script style Other indentation can be tweaked later as code changes, but the labels are an obvious bulk change. * Minor whitespace fixes Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb index c4d98a29cf7..175a44de6e3 100755 --- a/ctdb/config/events.d/00.ctdb +++ b/ctdb/config/events.d/00.ctdb @@ -121,7 +121,7 @@ set_ctdb_variables () ctdb_check_args "$@" case "$1" in - init) +init) # make sure we have a blank state directory for the scripts to work with rm -rf "$CTDB_SCRIPT_VARDIR" mkdir -p "$CTDB_SCRIPT_VARDIR" || \ @@ -133,13 +133,13 @@ case "$1" in fi ;; - setup) +setup) # Set any tunables from the config file set_ctdb_variables || \ die "Aborting setup due to invalid configuration - fix typos, remove unknown tunables" ;; - startup) +startup) $CTDB attach ctdb.tdb persistent ;; esac diff --git a/ctdb/config/events.d/01.reclock b/ctdb/config/events.d/01.reclock index 0377ca4c847..45b2405ce94 100755 --- a/ctdb/config/events.d/01.reclock +++ b/ctdb/config/events.d/01.reclock @@ -15,7 +15,7 @@ case "$CTDB_RECOVERY_LOCK" in esac case "$1" in - init) +init) ctdb_counter_init if [ -n "$CTDB_RECOVERY_LOCK" ] ; then @@ -24,7 +24,7 @@ case "$1" in fi ;; - monitor) +monitor) # Early exit if not using a reclock file [ -n "$CTDB_RECOVERY_LOCK" ] || exit 0 diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events.d/05.system index 38e40276bf2..780b6b98a53 100755 --- a/ctdb/config/events.d/05.system +++ b/ctdb/config/events.d/05.system @@ -164,7 +164,7 @@ END { case "$1" in - monitor) +monitor) monitor_filesystem_usage monitor_memory_usage ;; diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface index 57baba7c4ff..c6938d12ed9 100755 --- a/ctdb/config/events.d/10.interface +++ b/ctdb/config/events.d/10.interface @@ -138,7 +138,7 @@ ip_unblock () ctdb_check_args "$@" case "$1" in - init) +init) # make sure that we only respond to ARP messages from the NIC where # a particular ip address is associated. get_proc sys/net/ipv4/conf/all/arp_filter >/dev/null 2>&1 && { @@ -154,11 +154,11 @@ case "$1" in drop_all_public_ips ;; - startup) +startup) monitor_interfaces ;; - takeip) +takeip) iface=$2 ip=$3 maskbits=$4 @@ -173,7 +173,7 @@ case "$1" in flush_route_cache ;; - releaseip) +releaseip) # releasing an IP is a bit more complex than it seems. Once the IP # is released, any open tcp connections to that IP on this host will end # up being stuck. Some of them (such as NFS connections) will be unkillable @@ -201,7 +201,7 @@ case "$1" in flush_route_cache ;; - updateip) +updateip) # moving an IP is a bit more complex than it seems. # First we drop all traffic on the old interface. # Then we try to add the ip to the new interface and before @@ -243,7 +243,7 @@ case "$1" in tickle_tcp_connections "$ip" ;; - monitor) +monitor) monitor_interfaces || exit 1 ;; esac diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw index 9fdf93f2887..2cfe75b6acf 100755 --- a/ctdb/config/events.d/11.natgw +++ b/ctdb/config/events.d/11.natgw @@ -184,11 +184,11 @@ natgw_save_state () case "$1" in - setup) +setup) natgw_check_config ;; - startup) +startup) natgw_check_config # Error if CTDB_NATGW_PUBLIC_IP is listed in public addresses @@ -202,7 +202,7 @@ case "$1" in set_proc sys/net/ipv4/conf/all/arp_announce 2 ;; - updatenatgw|ipreallocated) +updatenatgw|ipreallocated) natgw_check_config ctdb_get_pnn @@ -226,12 +226,12 @@ case "$1" in natgw_save_state ;; - shutdown|removenatgw) +shutdown|removenatgw) natgw_check_config natgw_clear ;; - monitor) +monitor) natgw_check_config if [ -n "$CTDB_NATGW_PUBLIC_IFACE" ] ; then diff --git a/ctdb/config/events.d/11.routing b/ctdb/config/events.d/11.routing index 941a7a8f131..c8d875cd732 100755 --- a/ctdb/config/events.d/11.routing +++ b/ctdb/config/events.d/11.routing @@ -29,13 +29,13 @@ loadconfig } case "$1" in - ipreallocated) +ipreallocated) while read iface dest gw; do ip route add "$dest" via "$gw" dev "$iface" >/dev/null 2>&1 done <"${CTDB_BASE}/static-routes" ;; - updateip) +updateip) oiface=$2 niface=$3 while read iface dest gw; do diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing index 34bbf7f332a..bee8e2cc480 100755 --- a/ctdb/config/events.d/13.per_ip_routing +++ b/ctdb/config/events.d/13.per_ip_routing @@ -357,7 +357,7 @@ ctdb_check_args "$@" ctdb_service_check_reconfigure case "$1" in - startup) +startup) flush_rules_and_routes # make sure that we only respond to ARP messages from the NIC @@ -367,12 +367,12 @@ case "$1" in } ;; - shutdown) +shutdown) flush_rules_and_routes clean_up_table_ids ;; - takeip) +takeip) iface=$2 ip=$3 maskbits=$4 @@ -386,7 +386,7 @@ case "$1" in $CTDB gratiousarp "$ip" "$iface" ;; - updateip) +updateip) oiface=$2 niface=$3 ip=$4 @@ -402,7 +402,7 @@ case "$1" in tickle_tcp_connections "$ip" ;; - releaseip) +releaseip) iface=$2 ip=$3 maskbits=$4 @@ -411,7 +411,7 @@ case "$1" in del_routing_for_ip "$ip" ;; - ipreallocated) +ipreallocated) add_missing_routes remove_bogus_routes ;; diff --git a/ctdb/config/events.d/20.multipathd b/ctdb/config/events.d/20.multipathd index c16c24cf335..92561589029 100755 --- a/ctdb/config/events.d/20.multipathd +++ b/ctdb/config/events.d/20.multipathd @@ -72,7 +72,7 @@ multipathd_check() } case "$1" in - monitor) +monitor) multipathd_check || die "multipath monitoring failed" ;; esac diff --git a/ctdb/config/events.d/31.clamd b/ctdb/config/events.d/31.clamd index 22b11b8f851..c2ee8de5369 100755 --- a/ctdb/config/events.d/31.clamd +++ b/ctdb/config/events.d/31.clamd @@ -9,14 +9,14 @@ detect_init_style case $CTDB_INIT_STYLE in - redhat) - service_name="clamd" - service_config="clamd" - ;; - *) - service_name="clamav" - service_config="clamav" - ;; +redhat) + service_name="clamd" + service_config="clamd" + ;; +*) + service_name="clamav" + service_config="clamav" + ;; esac service_start () @@ -31,16 +31,16 @@ ctdb_start_stop_service is_ctdb_managed_service || exit 0 -case "$1" in - startup) +case "$1" in +startup) ctdb_service_start ;; - shutdown) +shutdown) ctdb_service_stop ;; - monitor) +monitor) ctdb_check_unix_socket ${CTDB_CLAMD_SOCKET} || exit $? ;; esac diff --git a/ctdb/config/events.d/40.vsftpd b/ctdb/config/events.d/40.vsftpd index 5f2f44a79ad..64da6fd16d2 100755 --- a/ctdb/config/events.d/40.vsftpd +++ b/ctdb/config/events.d/40.vsftpd @@ -34,20 +34,20 @@ is_ctdb_managed_service || exit 0 ctdb_service_check_reconfigure -case "$1" in - startup) +case "$1" in +startup) ctdb_service_start ;; - shutdown) +shutdown) ctdb_service_stop ;; - takeip|releaseip) +takeip|releaseip) ctdb_service_set_reconfigure ;; - monitor) +monitor) if [ -n "$service_tcp_ports" ] ; then if ctdb_check_tcp_ports $service_tcp_ports ; then ctdb_counter_init diff --git a/ctdb/config/events.d/41.httpd b/ctdb/config/events.d/41.httpd index 9fb75072254..7e3e3e3bccc 100755 --- a/ctdb/config/events.d/41.httpd +++ b/ctdb/config/events.d/41.httpd @@ -9,11 +9,11 @@ detect_init_style case $CTDB_INIT_STYLE in - redhat) +redhat) service_name="httpd" service_config="http" ;; - suse|debian|*) +suse|debian|*) service_name="apache2" service_config="apache2" ;; @@ -48,15 +48,15 @@ ctdb_start_stop_service is_ctdb_managed_service || exit 0 case "$1" in - startup) +startup) ctdb_service_start ;; - shutdown) +shutdown) ctdb_service_stop ;; - monitor) +monitor) if ctdb_check_tcp_ports 80 >/dev/null 2>/dev/null ; then ctdb_counter_init else diff --git a/ctdb/config/events.d/49.winbind b/ctdb/config/events.d/49.winbind index db93fafc160..495ac5791e3 100755 --- a/ctdb/config/events.d/49.winbind +++ b/ctdb/config/events.d/49.winbind @@ -40,16 +40,16 @@ is_ctdb_managed_service || exit 0 ########################### -case "$1" in - startup) +case "$1" in +startup) ctdb_service_start ;; - - shutdown) + +shutdown) ctdb_service_stop ;; - monitor) +monitor) ctdb_check_command wbinfo -p ;; esac diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba index ee4033f1c44..82b9b96029d 100755 --- a/ctdb/config/events.d/50.samba +++ b/ctdb/config/events.d/50.samba @@ -153,15 +153,15 @@ is_ctdb_managed_service || exit 0 ########################### case "$1" in - startup) +startup) ctdb_service_start ;; - shutdown) +shutdown) ctdb_service_stop ;; - monitor) +monitor) testparm_foreground_update 10 ret=$? diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index e5d87424ce6..6b2bdbc5758 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -246,25 +246,25 @@ is_ctdb_managed_service || exit 0 ctdb_service_check_reconfigure case "$1" in - startup) +startup) nfs_callout "$@" ;; - shutdown) +shutdown) nfs_callout "$@" ;; - takeip) +takeip) nfs_callout "$@" ctdb_service_set_reconfigure ;; - releaseip) +releaseip) nfs_callout "$@" ctdb_service_set_reconfigure ;; - monitor) +monitor) nfs_callout "monitor-pre" || exit $? # Check that directories for shares actually exist diff --git a/ctdb/config/events.d/70.iscsi b/ctdb/config/events.d/70.iscsi index 8c3f712b28d..83f69bf0001 100755 --- a/ctdb/config/events.d/70.iscsi +++ b/ctdb/config/events.d/70.iscsi @@ -21,7 +21,7 @@ is_ctdb_managed_service || exit 0 } case "$1" in - ipreallocated) +ipreallocated) all_ips=$($CTDB -X ip | tail -n +2) # Block the iSCSI port. Only block for the address families @@ -74,12 +74,12 @@ EOF ;; - shutdown) +shutdown) # Shutdown iSCSI daemon when ctdb goes down killall -9 tgtd >/dev/null 2>&1 ;; - monitor) +monitor) ctdb_check_tcp_ports 3260 || exit $? ;; esac diff --git a/ctdb/config/events.d/99.timeout b/ctdb/config/events.d/99.timeout index 2c70599d25c..4aa594085d8 100755 --- a/ctdb/config/events.d/99.timeout +++ b/ctdb/config/events.d/99.timeout @@ -14,7 +14,7 @@ loadconfig ctdb [ "$CTDB_RUN_TIMEOUT_MONITOR" = "yes" ] || exit 0 case "$1" in - monitor) +monitor) TIMEOUT=$($CTDB getvar EventScriptTimeout | awk '{print $3}') echo "sleeping for $((TIMEOUT * 2)) seconds..." sleep $((TIMEOUT * 2))