I to write a bash script to send an email when local host connection is refused and when the connection is open, it should not write an email. For example:
netcat -z localhost 8287
if [ $? -ne 0 ]; then
echo " Connection refused" |/usr/lib/sendmail -s "Port doesn't function " [email protected]
else
echo "open"
fi
When I fire this bash scriptit does't work. I replaced sendmail by mail, sendEmail also, but every time I am getting different errors.
/var/log/maillog
to your initial post