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" || \
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
esac
case "$1" in
- init)
+init)
ctdb_counter_init
if [ -n "$CTDB_RECOVERY_LOCK" ] ; then
fi
;;
- monitor)
+monitor)
# Early exit if not using a reclock file
[ -n "$CTDB_RECOVERY_LOCK" ] || exit 0
case "$1" in
- monitor)
+monitor)
monitor_filesystem_usage
monitor_memory_usage
;;
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 && {
drop_all_public_ips
;;
- startup)
+startup)
monitor_interfaces
;;
- takeip)
+takeip)
iface=$2
ip=$3
maskbits=$4
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
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
tickle_tcp_connections "$ip"
;;
- monitor)
+monitor)
monitor_interfaces || exit 1
;;
esac
case "$1" in
- setup)
+setup)
natgw_check_config
;;
- startup)
+startup)
natgw_check_config
# Error if CTDB_NATGW_PUBLIC_IP is listed in public addresses
set_proc sys/net/ipv4/conf/all/arp_announce 2
;;
- updatenatgw|ipreallocated)
+updatenatgw|ipreallocated)
natgw_check_config
ctdb_get_pnn
natgw_save_state
;;
- shutdown|removenatgw)
+shutdown|removenatgw)
natgw_check_config
natgw_clear
;;
- monitor)
+monitor)
natgw_check_config
if [ -n "$CTDB_NATGW_PUBLIC_IFACE" ] ; then
}
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
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
}
;;
- shutdown)
+shutdown)
flush_rules_and_routes
clean_up_table_ids
;;
- takeip)
+takeip)
iface=$2
ip=$3
maskbits=$4
$CTDB gratiousarp "$ip" "$iface"
;;
- updateip)
+updateip)
oiface=$2
niface=$3
ip=$4
tickle_tcp_connections "$ip"
;;
- releaseip)
+releaseip)
iface=$2
ip=$3
maskbits=$4
del_routing_for_ip "$ip"
;;
- ipreallocated)
+ipreallocated)
add_missing_routes
remove_bogus_routes
;;
}
case "$1" in
- monitor)
+monitor)
multipathd_check || die "multipath monitoring failed"
;;
esac
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 ()
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
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
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"
;;
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
###########################
-case "$1" in
- startup)
+case "$1" in
+startup)
ctdb_service_start
;;
-
- shutdown)
+
+shutdown)
ctdb_service_stop
;;
- monitor)
+monitor)
ctdb_check_command wbinfo -p
;;
esac
###########################
case "$1" in
- startup)
+startup)
ctdb_service_start
;;
- shutdown)
+shutdown)
ctdb_service_stop
;;
- monitor)
+monitor)
testparm_foreground_update 10
ret=$?
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
}
case "$1" in
- ipreallocated)
+ipreallocated)
all_ips=$($CTDB -X ip | tail -n +2)
# Block the iSCSI port. Only block for the address families
;;
- 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
[ "$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))