Update dsmon.sh

This commit is contained in:
2025-06-14 14:01:51 -05:00
parent e1f902fd08
commit 358e1ee754

View File

@@ -161,6 +161,12 @@ CHECK(){
nc_count=0; lc_count=0; completed=false; scanstart=$(date +%s)
until [ "${completed}" == "true" ]; do
until [ $(ls /tmp/dscheck.*.done 2>/dev/null | wc -l) -gt 0 ]; do tmp=tmp; done
echo -e "\r\r\n"
if [ "${1}" != "report" ]; then
[ ${nc_count} -gt ${lc_count} ] && echo
printf "\r${idsCL[LightCyan]}Completed on %d of %d hosts %s${idsCL[Default]}" "${nc_count}" "${#hostnames_sort[@]}" $([[ "$nc_count" -lt "${#hostnames_sort[@]}" ]] && echo " ..." || echo "")
fi
for host in /tmp/dscheck.*.done; do
NTS=$(grep -oP '(?<=dscheck\.).*?(?=\.done)' <<< "${host}")
if [ -n "$NTS" ]; then
@@ -170,10 +176,13 @@ CHECK(){
[ "${1}" != "report" ] && printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)"
rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1
((nc_count++))
if [ "${1}" != "report" ]; then
[ ${nc_count} -gt ${lc_count} ] && echo
printf "\r${idsCL[LightCyan]}Completed on %d of %d hosts %s${idsCL[Default]}" "${nc_count}" "${#hostnames_sort[@]}" $([[ "$nc_count" -lt "${#hostnames_sort[@]}" ]] && echo " ..." || echo "")
fi
fi
done
[ ${nc_count} -gt ${lc_count} ] && echo
[ "${1}" != "report" ] && printf "\r${idsCL[LightCyan]}Completed on %d of %d hosts %s${idsCL[Default]}" "${nc_count}" "${#hostnames_sort[@]}" $([[ "$nc_count" -lt "${#hostnames_sort[@]}" ]] && echo " ..." || echo "")
if [ $(($(date +%s)-scanstart)) -gt 300 ]; then