From 8c96ac25d8e9c23f1c74c093cd30e1f39585b550 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 14 May 2023 09:51:12 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 4c6b9d05..776492c4 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -451,11 +451,12 @@ SERVICE(){ else if [ "${4}" != "all" ]; then IP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) + echo "IP: ${IP}" for NTYPE in "${NODE_TYPES[@]}"; do var=${NTYPE}_HOSTS[@] NODE_TYPE="" for nip in "${!var}"; do - if [[ $(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) == *"${nip}"* ]]; then + if [[ "${IP}" == *"${nip}"* ]]; then NODE_TYPE=${NTYPE}; break 2 fi @@ -466,7 +467,8 @@ SERVICE(){ if [ "${NODE_TYPE}" == "" ]; then TSI=$(/sbin/ip link | grep tailscale0) - TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) + TSIP=$(/sbin/ip -o -4 addr list tailscale0 | awk '{print $4}' | cut -d/ -f1) + echo "TSIP: ${TSIP}" if [ ${#TSI} != 0 ]; then for nip in "${!var}"; do if [[ "${TSIP}" == *"${nip}"* ]]; then