network monitoring script ...help

Luis Costabile lcostabile at gmail.com
Thu Jun 17 20:56:28 UTC 2010


First of all, you should post scripts without special characters.

Change this line

for host in `awk '/^[0-9]/ { print $1 }' /home/jk/nethost`

To:
for host in `cat /home/jk/nethost`


On 17 June 2010 07:28, Jatin K <ssh.fedora at gmail.com> wrote:
>
> Hi all
>
> I've got the following[1] script from the Internet ( by googling )....
> but it is not working :-(
>
> can anyone tell me what is wrong with it ????
>
> [1]------------------
> #!/bin/sh
>
> for host in `awk '/^[0-9]/ { print $1 }' /home/jk/nethost`
> do
>        echo "Checking $host: \c"
>        ping $host 1 2>&1 | \
>           sed 's/.*no answer.*/[31;1m&[0m/;s/.*is alive.*/[32;2m&[0m/'
> done
>
> --------------------------
>
> the output of "cat /home/jk/nethost" is as under
>
> 172.16.10.1
> 172.16.20.1
> 172.16.30.1
> 172.16.40.1
> 172.16.50.1
> 172.16.60.1
> 172.16.70.1
> 172.16.80.1
>
> ------------------------------------------
>
> Regards
>
> --
>   °v°
>  /(_)\
>   ^ ^  Jatin Khatri
> Registerd Linux user No #501175
> www.counter.li.org
> No M$
>
> --
> users mailing list
> users at lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>


More information about the users mailing list