On Tue, 2002-05-28 at 12:00, tansel wrote:
> how can i see the all exported directories in subnet.. when showmount only 
> shows exported directories on a given IP or  hostname.but i wanna a 
> broadcasting way like a NETBUI
> 
> 

Hmmm.  I thought this was interesting.  the following is ugly but it
works.  I am sure I will get some comments from the scripting gurus but
it was the best I could do in 20 minutes or so with my lmited skills. 
Save the following script as findnfs, do  chmod u+x findnfs and call it
with ./findnfs from the same dir you saved it in.

If you dont like the errors at the end try calling it as:

findnfs 2>/dev/null


#!/bin/sh

#findnfs  
#Author:  Bret Hughes  <[EMAIL PROTECTED]>
#  does a broadcast ping and then trys to connect to all ipaddresses 
#  returned with show mount.


#  WARNING :  on a large subnet you probably don't want to do this 
#  but works great on my little lan of about 14 machines. 

#  only tested on a machine with a single ethernet interface.  Unknown
#  results for a machine with multiple interfaces

netaddr=$(ifconfig |awk '/Bcast/ {split($3,arr,":");print arr[2]}')
echo "the network address is $netaddr"
for machine in $(ping -b $netaddr -c3 |awk '/bytes from/{print $4}'|sort
|uniq); do 
    showresult=$(showmount -e ${machine/:/})
    if [ $? == 0 ]; then
    echo -e "\nexports from $machine"
        echo -e "$showresult"
    fi
done


Kind of fun. I did not know about showmount.  I am glad you asked the
question. ( I alwys wondered how webmin did that)

HTH

Bret



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to