Alright, I have being checking out various posting here trying to hack together something for a friend
Needed:
A script that can run in cron doing:
ping of several hosts and notifying via email when they are unavailable.
I am not going to post my non working messes (I am a basic scripter), but I have tried several approaches and just dont have the strong knowledge base to push variables around in a script.
Suggestions Please..
using: bash on redhat linux box
actually here is the latest script:
#!/bin/bsh
#################################
for file in `cat iplist.txt`
do
ping -c 1 -A $file | grep errors | wc -l
read tom
echo $tom
if [ "$tom" != 0 ]
then
mail -s"Test"
exx@xx.com
else
mail -s"Worked"
exx@xx.com
fi
done
OH how the heck do I get the mail program to just fire out the email? I know in solaris mailx will nicely shoot out the email...
Also my variations of this produce nice frustrating results...like the if then aint working right. Figure read is seen it as a string? At least that is my guess...