Update dsmon.sh

This commit is contained in:
2025-06-14 12:27:34 -05:00
parent 89ace9ba61
commit 7b171e4b7c

View File

@@ -87,6 +87,8 @@ RUN(){
fi
}
sleep="10s"
CHECK(){
rm -f /tmp/dscheck.*
start=`date +%s`
@@ -163,14 +165,14 @@ chmod +x /tmp/run_check_${hostname}.sh
until [ "${completed}" == "true" ]; do
until [ $(ls /tmp/dscheck.*.done 2>/dev/null | wc -l) -gt 0 ]; do tmp=tmp; done
for host in /tmp/dscheck.*.done; do
sleep 1s
sleep ${sleep}
NTS=$(grep -oP '(?<=dscheck\.).*?(?=\.done)' <<< "${host}")
if [ -n "$NTS" ]; then
# echo "'$host' = '$NTS'"
while IFS= read -r line; do
printf "%s\n" "$line"
done < /tmp/dscheck.${NTS}.results
# printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)"
# while IFS= read -r line; do
# printf "%s\n" "$line"
# done < /tmp/dscheck.${NTS}.results
printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)"
rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1
((nc_count++))
fi
@@ -342,7 +344,7 @@ ${DRIVE} : ${DRIVEINFO_FREE[$DRIVE]}GB out of ${DRIVEINFO_TOT[$DRIVE]}GB Free ($
else
echo -e "${idsCL[Yellow]} ${host_name[$hostid]} is down${idsCL[Default]}"; echo
fi
sleep 1s
sleep ${sleep}
mv /tmp/dscheck.${hostname}.running /tmp/dscheck.${hostname}.done
}