Update nodemgmt-scripts.sh

This commit is contained in:
2024-03-09 12:05:55 -06:00
parent 8faaa94792
commit 6ef99ef2ea

View File

@@ -332,28 +332,27 @@ NODEUPDATES() {
if [[ ${RUN_NODE_IP} == *"${nip}"* ]]; then
nip='localhost '
fi
echo "HERE: ${nip} - ${2}"
NODEUPDATE "${nip}" "${2}" "${NMCMD}" ###&
NODEUPDATE "${nip}" "${2}" "${NMCMD}" &
((ncount++))
done
done
# nc_count=0; completed=false
# until [ "${completed}" == "true" ]; do
# for nodecmd in /tmp/.nodeupdate.*.done; do
# if [[ "${nodecmd}" != *"*"* ]]; then
# nodecmd_output=$(cat ${nodecmd})
# [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}"
# rm -f ${nodecmd}
# ((nc_count++))
# fi
# done
# if [ ${nc_count} -eq ${ncount} ]; then
# completed=true
# break
# fi
# sleep 2s
# done
nc_count=0; completed=false
until [ "${completed}" == "true" ]; do
for nodecmd in /tmp/.nodeupdate.*.done; do
if [[ "${nodecmd}" != *"*"* ]]; then
nodecmd_output=$(cat ${nodecmd})
[ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}"
rm -f ${nodecmd}
((nc_count++))
fi
done
if [ ${nc_count} -eq ${ncount} ]; then
completed=true
break
fi
sleep 2s
done
echo -e "${idsCL[Green]}All Nodes have been Updated.${idsCL[Default]}"
echo
@@ -403,9 +402,9 @@ NODEUPDATE(){
${NCMD} "nodemgmt update q" >> ${tmpfile}.running
fi
else
echo -en " ~ ${idsCL[LightCyan]}Sync Shared Nodemgmt Defaults${idsCL[Default]} : " ###>> ${tmpfile}.running
${NMCMD} rsync -az ${NM_FOLDER}/conf/*.inc ${NM_FOLDER}/conf/*.conf root@${nip}:${NM_FOLDER}/conf/ ###& >/dev/null 2>&1
echo -e "${idsCL[Green]}Files Synced${idsCL[Default]}" ###>> ${tmpfile}.running
echo -en " ~ ${idsCL[LightCyan]}Sync Shared Nodemgmt Defaults${idsCL[Default]} : " >> ${tmpfile}.running
${NMCMD} rsync -az ${NM_FOLDER}/conf/*.inc ${NM_FOLDER}/conf/*.conf root@${nip}:${NM_FOLDER}/conf/ >/dev/null 2>&1
echo -e "${idsCL[Green]}Files Synced${idsCL[Default]}" >> ${tmpfile}.running
fi
else
echo -e " ~ ${idsCL[LightCyan]}NodeMGMT${idsCL[Default]} : Skipping BETA Update" >> ${tmpfile}.running
@@ -415,7 +414,7 @@ NODEUPDATE(){
else
echo -e " ~ ${idsCL[LightCyan]}Skipping${idsCL[Default]}" >> ${tmpfile}.running
fi
mv ${tmpfile}.running ${tmpfile}.done
[ -f ${tmpfile}.running ] && mv ${tmpfile}.running ${tmpfile}.done || touch ${tmpfile}.done
}
ADD_LOGROTATE_CRONTAB(){
@@ -1215,7 +1214,7 @@ GUI(){
if [ "${2}" == "report" ]; then
[ "${3}" == "sync" ] && ufile=update-nodes-sync.lastrun || ufile=update-nodes.lastrun
rm -f ${NM_LOGFOLDER}/${ufile}
NODEUPDATES ${2} ${3} ###> ${NM_LOGFOLDER}/${ufile}
NODEUPDATES ${2} ${3} > ${NM_LOGFOLDER}/${ufile}
else
NODEUPDATES ${2} ${3}
fi