#!/bin/bash
SRVLIST='192.168.0.100:80
192.168.0.100:53'
MAILACCOUNT="root@server1.example.com"
for SRV in `echo $SRVLIST`
do
IP=`echo $SRV | cut -d: -f1`
PORT=`echo $SRV | cut -d: -f2`
nc -w 1 $IP $PORT > /dev/null 2>&1 || echo "Port $PORT on Server $IP is failed" | mail -s "Error: Service failed" $MAILACCOUNT
done
No comments:
Post a Comment