1
0

More details in view and add CMD

This commit is contained in:
2025-12-14 04:01:34 +01:00
parent 0387b79f3e
commit 1ce9422d09
2 changed files with 20 additions and 2 deletions

View File

@@ -29,7 +29,19 @@ selectNodes(){
for NODE in "${NODES[@]}"; do
# shellcheck disable=SC2206
local FIELDS=(${NODE//;/ })
OPTIONS+=("${INDEX}:${FIELDS[0]}" "${FIELDS[1]}" "${FULL}")
local DESKSKIP=0
local DESC=""
for FIELD in "${FIELDS[@]}"; do
if [ ${DESKSKIP} -gt 1 ]; then
if [ "${DESC}" == "" ]; then
DESC="${FIELD/:*/}"
else
DESC="${DESC}|${FIELD/:*/}"
fi
fi
DESKSKIP=$(( DESKSKIP + 1))
done
OPTIONS+=("${INDEX}:${FIELDS[0]}" "${FIELDS[1]} [${DESC}]" "${FULL}")
INDEX+=1
done
if ! SEL=$(whiptail --title "NetUpgrade" --checklist "" 0 0 0 \
@@ -178,11 +190,16 @@ runCmd() { #$1=host $2=name #3=cmd
ERROR=1
fi
;;
cmd)
echo "cmd" | tee -a "${LOGFILENAME}"
if ! ssh root@"${HOST}" "${CMDVAL}" -f | tee -a "${LOGFILENAME}"; then
ERROR=1
fi
;;
docker-stacks)
echo "docker stacks update" | tee -a "${LOGFILENAME}"
echo "for each" | tee -a "${LOGFILENAME}"
echo " docker compose pull; docker compose up -d" | tee -a "${LOGFILENAME}"
#if ! ssh root@"${HOST}" 'for dir in '"${CMDVAL}"'/*; do (cd "${dir}"; docker compose pull; docker compose up -d); done; docker image prune -f' | tee -a "${LOGFILENAME}"; then
if ! ssh root@"${HOST}" 'for dir in '"${CMDVAL}"'/*; do (cd "${dir}"; docker compose pull; docker compose up -d); done; docker image prune -f' | tee -a "${LOGFILENAME}"; then
ERROR=1
fi

View File

@@ -6,3 +6,4 @@ NODES+=("10.0.0.103;alpine-01;apk;reboot")
NODES+=("10.0.0.104;redhat-01;yum;reboot")
NODES+=("10.0.0.105;freebsd-01;pkg;reboot")
NODES+=("10.0.0.211;docker-01;docker-stacks:/srv/stacks")
NODES+=("10.0.0.105;docker-01;cmd:reboot")