#!/bin/sh
 
# variables
RANGO="192.168.30"
N_COPIAS=3
MI_IP=`ip route | awk '/link/ {print $9}'`      # awk hace de grep, con /link/ "matcha" la linea y elimina el CR
 
 
for hosts in `nmap -sP $RANGO.1-254 2>/dev/null | grep "appears to be up" | awk '{print $2}'`
do
	RESULT=`rpcinfo -u $hosts nfs 2>/dev/null | grep -c "listo y a la espera"`
	if [ "$RESULT" -eq "1" ]; then
#		echo -n "NFS Responde $hosts"
		ISMOUNTHERE=`showmount -e $hosts | grep -c "^/home/vpn "`
		if [ "$ISMOUNTHERE" -eq "1" ]; then
#			echo -n " Backups Available Here"
			echo "$hosts";
		else
 
#			echo " Backups NOT Available"
			echo -n ""
		fi
	fi
done