LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I am in need of a shell script (https://www.linuxquestions.org/questions/linux-newbie-8/i-am-in-need-of-a-shell-script-701401/)

hasan_sust 02-01-2009 06:04 AM

I am in need of a shell script
 
Hello All
I want to ping several ips from a linux machine, put this ping results to .xls file in hhmmddmmyy format. Again If if the packet loss is greater than 20%, script will send a mail to administrator, to an ftp server. Script will read ip lists from a file. I am new at linux . Please help me asap.

saavik 02-01-2009 06:24 AM

It`s not 100% what you are looking for, but it`s a start!

Code:

clear
name=$1
echo "Rechner mit der IP: " $name " wird ueberwacht!"

touch ./pingtest-dir/$1

echo "Rechner mit der IP: " $1 "wird überprüft!" >> ./pingtest-dir/$name
echo "========================================="  >> ./pingtest-dir/$name

i=1

while [ $i -eq 1 ]
        do
        datum=`date +%Y-%b-%d-%H-%M-Uhr`
        echo $datum  >> ./pingtest-dir/$name
        /bin/ping -c 1 $1 | /usr/bin/tail -1  >> ./localtools/pingtest-dir/$name
        sleep 600
        done



All times are GMT -5. The time now is 04:41 PM.