Below code is working as expected but creating too many child processes when the url is not up and every minute that process is sending false email alerts
any help with the logic not to generate child process and not to send duplicate alerts
app="https://url"
appresult=$(wget --no-check-certificate -S $app 2>&1>/dev/null | grep -c "HTTP/1.1 401")
if [ "$appresult" -eq "0" ]; then
MESSAGE="Application has stopped running on "$HOST
echo $MESSAGE | mailx -s $App_Down_alert $ADMIN
fi
Please correct me, but I'm seeing a single pass code snippet only, no loop or other reason for multiple connects, child processes, mails. Is that the entire code? Or did you miss something?