Update dsmon.sh
This commit is contained in:
12
dsmon.sh
12
dsmon.sh
@@ -152,7 +152,7 @@ CHECK(){
|
|||||||
unbuffer bash -c "/usr/local/bin/dsmon runcheck '${hostname}'" > /tmp/dscheck.${hostname}.results &
|
unbuffer bash -c "/usr/local/bin/dsmon runcheck '${hostname}'" > /tmp/dscheck.${hostname}.results &
|
||||||
# unbuffer RUN_CHECK "$hostname" > /tmp/dscheck.${hostname}.results &
|
# unbuffer RUN_CHECK "$hostname" > /tmp/dscheck.${hostname}.results &
|
||||||
((started_hosts++))
|
((started_hosts++))
|
||||||
printf "\r${idsCL[LightCyan]}${MSG}${spc}: Started on %d of %d hosts ...${idsCL[Default]}" "${started_hosts}" "${#hostnames_sort[@]}"
|
[ "${1}" != "report" ] && printf "\r${idsCL[LightCyan]}${MSG}${spc}: Started on %d of %d hosts ...${idsCL[Default]}" "${started_hosts}" "${#hostnames_sort[@]}"
|
||||||
done
|
done
|
||||||
[ "${1}" != "report" ] && echo -e "\r\033[2K${idsCL[LightCyan]}${MSG}${spc}: ${idsCL[LightGreen]}Done${idsCL[Default]}"
|
[ "${1}" != "report" ] && echo -e "\r\033[2K${idsCL[LightCyan]}${MSG}${spc}: ${idsCL[LightGreen]}Done${idsCL[Default]}"
|
||||||
|
|
||||||
@@ -163,15 +163,15 @@ CHECK(){
|
|||||||
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 [ -n "$NTS" ]; then
|
if [ -n "$NTS" ]; then
|
||||||
while IFS= read -r line; do
|
# while IFS= read -r line; do
|
||||||
printf "%s\n" "$line"
|
# printf "%s\n" "$line"
|
||||||
done < /tmp/dscheck.${NTS}.results
|
# done < /tmp/dscheck.${NTS}.results
|
||||||
# printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)"
|
[ "${1}" != "report" ] && printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)"
|
||||||
rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1
|
rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1
|
||||||
((nc_count++))
|
((nc_count++))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf "\n${idsCL[LightCyan]}Completed on %d of %d hosts ...${idsCL[Default]}" "${nc_count}" "${#hostnames_sort[@]}"
|
[ "${1}" != "report" ] && printf "\n${idsCL[LightCyan]}Completed on %d of %d hosts ...${idsCL[Default]}" "${nc_count}" "${#hostnames_sort[@]}"
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user