On 11/04/2014 02:49 PM, José María Terry Jiménez wrote:
El 04/11/14 a las 20:36, Frank Cox escribió:
I would like to set up a cron job to automatically check whether my mailserver and webserver are up, and tell me if they're not.
This script tells me if my webserver is up:
#!/bin/bash
wget -q --tries=10 --timeout=20 --spider http://melvilletheatre.com
if [[ $? -eq 0 ]]; then
echo "Online"
else
echo "Offline"
fi
How can I do the something similar with my mailserver?
Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested.
Hello
I use Nmap to test if a server up in a port:
$ nmap -p587 a.mail.server |grep -i 587
587/tcp open submission
Or several ports:
$ nmap -p25,143,587 a.mail.server |grep -i open
25/tcp open smtp
143/tcp open imap
587/tcp open submission
If the server is working, the port is shown as open. You can parse it as
desired to message you as you want
Best
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos
How about using nc with something like this:
No server listening at 10.0.129.71
$ nc 10.0.129.71 25 << EOF
QUIT
EOF
$ echo $?
1
Server listening at localhost
$ nc localhost 25 << EOF
QUIT
EOF
220 sclark66.netwolves.com ESMTP Sendmail 8.14.4/8.14.4; Tue, 4 Nov 2014 15:03:22 -0500
221 2.0.0 sclark66.netwolves.com closing connection
$ echo $?
0
--
Stephen Clark
*NetWolves Managed Services, LLC.*
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@xxxxxxxxxxxxx
http://www.netwolves.com
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos