Update dsmon.sh

This commit is contained in:
2025-06-01 21:48:23 -05:00
parent 4ac9b106d9
commit 6a67e49577

View File

@@ -134,33 +134,34 @@ CHECK(){
for hostname in "${hostnames_sort[@]}"; do for hostname in "${hostnames_sort[@]}"; do
until [ $(ls /tmp/dscheck.*.running 2>/dev/null | wc -l) -lt 6 ]; do tmp=tmp; done until [ $(ls /tmp/dscheck.*.running 2>/dev/null | wc -l) -lt 6 ]; do tmp=tmp; done
# RUN_CHECK ${hostname} > /tmp/dscheck.${hostname}.results 2>/dev/null & # RUN_CHECK ${hostname} > /tmp/dscheck.${hostname}.results 2>/dev/null &
RUN_CHECK RUN_CHECK ${hostname}
done done
[ "${1}" != "report" ] && echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}\n" [ "${1}" != "report" ] && echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}\n"
# nc_count=0; completed=false; scanstart=$(date +%s) nc_count=0; completed=false; scanstart=$(date +%s)
# until [ "${completed}" == "true" ]; do until [ "${completed}" == "true" ]; do
# # until [ $(ls /tmp/dscheck.*.done 2>/dev/null | wc -l) -gt 0 ]; do tmp=tmp; done # until [ $(ls /tmp/dscheck.*.done 2>/dev/null | wc -l) -gt 0 ]; do tmp=tmp; done
# for host in /tmp/dscheck.*.done; do for host in /tmp/dscheck.*.done; do
# NTS=$(grep -oP '(?<=dscheck.).*?(?=.done)' <<< "${host}") NTS=$(grep -oP '(?<=dscheck.).*?(?=.done)' <<< "${host}")
# if [ "${NTS}" != "*" ]; then if [ "${NTS}" != "*" ]; then
# hoststatus=$(cat /tmp/dscheck.${NTS}.results) hoststatus=$(cat /tmp/dscheck.${NTS}.results)
# [ "${hoststatus}" != "" ] && echo -e "${hoststatus}" [ "${hoststatus}" != "" ] && echo -e "${hoststatus}"
# rm -f /tmp/dscheck.${NTS}.* rm -f /tmp/dscheck.${NTS}.*
# ((nc_count++)) ((nc_count++))
# fi fi
# done done
# if [ $(($(date +%s)-scanstart)) -gt 300 ]; then if [ $(($(date +%s)-scanstart)) -gt 300 ]; then
# SENDNOTICE "DSmon Scan Stuck" "DSmon Check scan has been running for 10mins, klling all bash...." 1 SENDNOTICE "DSmon Scan Stuck" "DSmon Check scan has been running for 10mins, klling all bash...." 1
# killall bash killall bash
# exit 1 pw service all restart
# fi exit 1
# if [ ${nc_count} -eq ${#hostnames_sort[@]} ]; then fi
# completed=true if [ ${nc_count} -eq ${#hostnames_sort[@]} ]; then
# break completed=true
# fi break
# sleep 1s fi
# done sleep 1s
done
end=`date +%s`; runtime=$((end-start)); echo -e "\nScript Runtime: ${runtime}" end=`date +%s`; runtime=$((end-start)); echo -e "\nScript Runtime: ${runtime}"
echo echo