![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mac OS X 10.5: Can receive email, but not send email | iBot | OS X Support RSS | 0 | 10-13-2008 10:20 PM |
| Mac OS X 10.5: Can receive email, but not send email | iBot | OS X Support RSS | 0 | 09-27-2008 07:12 AM |
| blocking the commands result | rag84dec | Shell Programming and Scripting | 2 | 03-27-2008 01:37 AM |
| Send email where # is in the email address - Using Unix | jingi1234 | UNIX for Dummies Questions & Answers | 1 | 05-23-2005 11:23 AM |
| Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) | Vetrivela | UNIX for Advanced & Expert Users | 2 | 02-15-2005 10:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
i want to create a script which should do the following: 1) ping the remote servers and email the hosts which are down 2) netstat on port x on 2 server and email the result too. I want both results to be sent in the same email. I have few ideas but i can't finish it. Here is my idea: #!/bin/bash HOSTS="host1 host2" # email report SUBJECT="Ping failed" EMAILID="jon@abc.com" for myHost in $HOSTS do jj=$(ping $myHost -w2 | awk '/received/ {print $4}') if [ $jj -eq 0 ] then # 100% failed echo "Host : $myHost is down (ping failed) at $(date)" | mail -s $SUBJECT" $EMAILID fi done #check netstat net=$(netstat -na|grep 5005) if ($net) then echo $net else ssh host2 $net echo "The app is running on $HOST and is connected on $net"| mail -s "$SUBJECT" $EMAILID My issues are: 1) i don't know how to send in one mail both result 2) i don't know how to check the netstat command on if ...then Many thanks for your help |
|
|||||
|
(echo "first echo"; echo "second echo") | mailx -s test jon@abc.com
|
![]() |
| Bookmarks |
| Tags |
| ping, ping port, port, port ping |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|