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...More Information:
- add --ping option - decrease the ping time to 10 sec (use --ping above if you don't like it) - hack the init script to use the new --ping option
- 131 gemstone bash# ping starship bash# ping gemstone bash# telnet gemstone bash# ftp gemstone
- com and as soon as i can't ping it anymore, I want to restart my network card - this script
- bash script is downloaded from a server every time the user logs in, no one can exclude the possibility that it did something
- script: #!/bin/bash echo "Content-type: text/plain" echo /bin/ping -c1 www
More:
- simple scripting question
- Invoking shell script from shell script
- Running remote shell script containing sql statements
- variables in sed
- Hash Question in Perl
- Array length in PERL
- Utility or script for renaming files on UNIX web server
- compress files
- simple shell - how to get a parameter typed in a shell script
- adding columns


LinkBack URL
About LinkBacks
Reply With Quote

























































Bookmarks