awk -v min="$CTDB_PER_IP_ROUTING_TABLE_ID_LOW" \
-v max="$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" \
-v pre="$table_id_prefix" \
- '/^#/ || \
- !(min <= $1 && $1 <= max) && \
- !(index($2, pre) == 1) \
+ '/^#/ ||
+ !(min <= $1 && $1 <= max) &&
+ !(index($2, pre) == 1)
{ print $0 }' "$rt_tables" >"$_tmp"
mv "$_tmp" "$rt_tables"
*:*) _bits=128 ;;
*) _bits=32 ;;
esac
-
ip addr show to "${_addr}/${_bits}" 2>/dev/null | \
- awk 'NR == 1 { iface = $2; sub(":$", "", iface) ; \
- sub("@.*", "", iface) } \
- $1 ~ /inet/ { mask = $2; sub(".*/", "", mask); \
+ awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
+ sub("@.*", "", iface) }
+ $1 ~ /inet/ { mask = $2; sub(".*/", "", mask);
print mask, iface }'
}
# Extract the full interface description to see if it is a VLAN
_t=$(echo "$_iface_info" |
- awk 'NR == 1 { iface = $2; sub(":$", "", iface) ; \
+ awk 'NR == 1 { iface = $2; sub(":$", "", iface) ;
print iface }')
case "$_t" in
*@*)
# hosted public IP addresses.
ctdb_ips=$($CTDB ip | tail -n +2)
sed_expr=$(echo "$ctdb_ips" |
- awk -v pnn="$pnn" 'pnn == $2 { \
- ip = $1; gsub(/\./, "\\.", ip); \
+ awk -v pnn="$pnn" 'pnn == $2 {
+ ip = $1; gsub(/\./, "\\.", ip);
printf "/statd-state@%s@/p\n", ip }')
# Intentional multi-word expansion for multiple files
# shellcheck disable=SC2086
# but only for the server-IPs that are hosted on this node.
ctdb_all_ips=$($CTDB ip all | tail -n +2)
sed_expr=$(echo "$ctdb_all_ips" |
- awk -v pnn="$pnn" 'pnn == $2 { \
- ip = $1; gsub(/\./, "\\.", ip); \
+ awk -v pnn="$pnn" 'pnn == $2 {
+ ip = $1; gsub(/\./, "\\.", ip);
printf "s/^key.*=.*statd-state@\\(%s\\)@\\([^\"]*\\).*/\\1 \\2/p\n", ip }')
statd_state=$($CTDB catdb ctdb.tdb | sed -n "$sed_expr" | sort)
# BANNED or STOPPED)
awk -F '|' -v ms="$_ms" \
'BEGIN { ret = 2 }
- ms ~ "@" $2 "@" && \
+ ms ~ "@" $2 "@" &&
$5 == 0 && $6 == 0 && $8 == 0 { print $1, $2 ; ret=0 ; exit }
END { exit ret }' <<EOF ||
$nodestatus_X
# DISCONNECTED, DISABLED or STOPPED
awk -F '|' -v ms="$_ms" \
'BEGIN { ret = 2 }
- ms ~ "@" $2 "@" && \
+ ms ~ "@" $2 "@" &&
$3 == 0 && $5 == 0 && $7 == 0 { print $1, $2 ; ret=0 ; exit }
END { exit ret }' <<EOF ||
$nodestatus_X
# DISABLED
awk -F '|' -v ms="$_ms" \
'BEGIN { ret = 2 }
- ms ~ "@" $2 "@" && \
+ ms ~ "@" $2 "@" &&
$3 == 0 && $5 == 0 { print $1, $2 ; ret=0 ; exit }
END { exit ret }' <<EOF
$nodestatus_X