Update dsmon.sh

This commit is contained in:
2024-01-06 23:29:14 -06:00
parent f81948ae3a
commit 17166181cb

View File

@@ -142,23 +142,25 @@ CHECK(){
nc_count=0; completed=false; scanstart=$(date +%s)
until [ "${completed}" == "true" ]; do
for host in /tmp/dscheck.*.done >/dev/null 2>&1; do
NTS=$(grep -oP '(?<=dscheck.).*?(?=.done)' <<< "${nodestatus}")
if [ "${NTS}" != "*" ]; then
hoststatus=$(cat /tmp/dscheck.${NTS}.results)
[ "${hoststatus}" != "" ] && echo -e "${hoststatus}"
rm -f /tmp/dscheck.${NTS}.*
((nc_count++))
if [ -f /tmp/dscheck.*.done ]; then
for host in /tmp/dscheck.*.done >/dev/null 2>&1; do
NTS=$(grep -oP '(?<=dscheck.).*?(?=.done)' <<< "${nodestatus}")
if [ "${NTS}" != "*" ]; then
hoststatus=$(cat /tmp/dscheck.${NTS}.results)
[ "${hoststatus}" != "" ] && echo -e "${hoststatus}"
rm -f /tmp/dscheck.${NTS}.*
((nc_count++))
fi
done
if [ $(($(date +%s)-scanstart)) -gt 600 ]; then
SENDNOTICE "NMG Scan Stuck" "DSmon Check scan has been running for 10mins, klling all bash...." 1
killall bash
exit 1
fi
if [ ${nc_count} -eq ${#hostnames_sort[@]} ]; then
completed=true
break
fi
done
if [ $(($(date +%s)-scanstart)) -gt 600 ]; then
SENDNOTICE "NMG Scan Stuck" "DSmon Check scan has been running for 10mins, klling all bash...." 1
killall bash
exit 1
fi
if [ ${nc_count} -eq ${#hostnames_sort[@]} ]; then
completed=true
break
fi
sleep 1s
done