Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 522

Ver diferencias:

dhcp-server-denegar/trunk/dhcp-server-denegar
cat pcs.leases | while read linea ; do
KEY=`echo $linea | awk '{print $1}'`
case "$KEY" in
lease) IpPC=`echo $linea | awk '{print $2}'`
lease)
IpPC=`echo $linea | awk '{print $2}'`
;;
hardware) MacPC=`echo $linea | awk '{print $3}' | cut -f1 -d';' | tr A-Z a-z`
hardware)
MacPC=`echo $linea | awk '{print $3}' | cut -f1 -d';' | tr A-Z a-z`
;;
client-hostname) NombrePC=`echo $linea | awk -F'"' '{print $2}'`
client-hostname)
NombrePC=`echo $linea | awk -F'"' '{print $2}'`
;;
'}')
if [ $MacPC ]; then
if [ "$MacPC" ]; then
esta=`grep -i $MacPC pcs` 2>/dev/null
if [ ! $esta ]; then
echo "$MacPC,$IpPC,$NombrePC" >> pcs
fi
NombrePc=""
NombrePC=""
fi
;;
"")
......
IP=`echo $linea | cut -f2 -d,`
PC=`echo $linea | cut -f3 -d,`
ESTA=`grep -i $MAC $LISTA_BLANCA` 2>/dev/null
if [ ! $ESTA ]; then
ESTA=`grep -i $MAC $LISTA_NEGRA` 2>/dev/null
if [ ! $ESTA ]; then
ESTA=`grep -i ^$MAC $LISTA_BLANCA` 2>/dev/null
if [ ! "$ESTA" ]; then
ESTA=`grep -i ^$MAC $LISTA_NEGRA` 2>/dev/null
if [ ! "$ESTA" ]; then
echo "$MAC,$PC,$IP" >> $LISTA_NEGRA
fi
else
EQUIPO=`grep ^$MAC $LISTA_BLANCA | cut -f1-2 -d,`
EQUIPO=`grep -i ^$MAC $LISTA_BLANCA | cut -f1-2 -d,`
grep -v ^$MAC $LISTA_BLANCA > tmp
mv tmp $LISTA_BLANCA
echo "$EQUIPO,$IP,$PC" >> $LISTA_BLANCA
......
mv tmp $LISTA_NEGRA
fi
done
rm -f pcs.leases
#rm -f pcs.leases
}
Crear_Configuracion() {

Exportar a: Unified diff