aixtutorial
asked on
This is IBM AIX..Need a script to ping a server
This is in IBM AIX 5.3..Please provide a script which will try to ping or telnet a session to server abcxyz01 on 9704 every couple of mins and send an e-mail as soon as the port is down..Please let me knoe if you want me to setup the script on the same server or I can do that on other server..
ASKER
wmp,
I have used the script and executed it..I enetred the worng port just to check if the e-maiis getting trigered..The sendmail daemon is running but havent got any e-mails for this..Please let me know is there anything that I need to modify
Thanks
I have used the script and executed it..I enetred the worng port just to check if the e-maiis getting trigered..The sendmail daemon is running but havent got any e-mails for this..Please let me know is there anything that I need to modify
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
here is a script using "telnet" I once wrote and which several EE askers found useful.
It can test any given port.
Customize PORT, HOST and MAILTO below as desired.
#!/bin/sh
PORT=23
HOST=hostname
MAILTO="aixtutorial@domain
CHECKFILE=/tmp/sshchk.$$
SLEEPTIME=2
( telnet $HOST $PORT 2>&1 ) > $CHECKFILE &
JOB=$!
sleep $SLEEPTIME
kill $JOB 2>/dev/null
if grep -q "Connected to" $CHECKFILE ; then
:
else
mailx -s "Port $PORT on server $HOST is down!" $MAILTO < $CHECKFILE
fi
rm $CHECKFILE 2>/dev/null
exit
wmp