[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

script zumbi (defunct)



Galera, to om um problema nesse script q esta mais embaixo. Ele executa ate o ultimo comando mas não termina a execução, quando eu dou um ps pra ver os processos aparece lá que ele virou um processo zumbi (defunct). jah revisei o script varias vezes e nao achei o que tah causando isso. Se alguem já teve essa experiencia por favor me ajude.
abrigado



#!/bin/bash
set -e

Principal() {

. /usr/share/debconf/confmodule


db_fset config-fromti/hostname seen true
db_input critical config-fromti/hostname || true
db_go || true

db_get config-fromti/hostname
HOSTNAME=$RET

echo "name $HOSTNAME" > /root/config-fromti

#############  testa se os cabos estao plugados corretamente  #############################

#db_fset config-fromti/cabos seen true
#db_input critical config-fromti/cabos || true
#db_go || true

#db_get config-fromti/cabos

# lista o numero de interfaces de rede
cat /etc/udev/rules.d/z25_persistent-net.rules | sed -n '/eth/h;${x;p;}' |awk '{print $4}' |cut -dh -f2 |cut -d\" -f1 > interfaces.txt

INTERFACES=$(wc -l interfaces.txt |awk '{print $1}')

#lista o numero de interfaces de rede ativas da maquina
mii-tool |grep ok > numero-interfaces.txt

ATIVAS=$(wc -l numero-interfaces.txt | awk '{print $1}')

#compara o numero de interfaces com o numero de interfaces ativas
while [ $ATIVAS != $INTERFACES ]; do

        db_fset config-fromti/semsinal seen true
    db_input critical config-fromti/semsinal || true
    db_go || true

    db_get config-fromti/semsinal

done

exit

dhclient


###########  escolhe qual a interface interna e externa  ##############

INTERFACE_INTERNA=$(netstat -r |awk '{print $8}' |sed -n '/eth/{p;q;}')
INTERFACE_EXTERNA=$(netstat -r |grep 255 |awk '{print $8}' |sed -n '/eth/h;${x;p;}')

###############################################################################


#salva a linha com o endereço de rede e a mascara no arquivo testelog
netstat -r |grep $INTERFACE_INTERNA  > testelog.txt

#separa o endereço de rede
REDE=$(sed -n '/eth/{p;q;}' testelog.txt |awk '{print $1}')
echo "endereco de rede = $REDE" >> /root/config-fromti

#separa a mascara de rede
MASCARA=$(sed -n '/eth/{p;q;}' testelog.txt |awk '{print $1}')
echo "mascara de rede = $MASCARA" >> /root/config-fromti

################################################################################

echo "endrede $REDE" >> /root/config-fromti

db_fset config-fromti/ipint seen true
db_input critical config-fromti/ipint || true
db_go || true

db_get config-fromti/ipint
IPINT=$RET

echo "ipinterno $IPINT" >> /root/config-fromti

echo "interfaceinterna $INTERFACE_INTERNA" >> /root/config-fromti

echo "mascara $MASCARA" >> /root/config-fromti

echo "auto lo" > /root/interfaces
echo "iface lo inet loopback" >> /root/interfaces
echo " " >> /root/interfaces
echo " " >> /root/interfaces
echo "auto $INTERFACE_INTERNA" >> /root/interfaces
echo "iface $INTERFACE_INTERNA inet static" >> /root/interfaces
echo "address $IPINT" >> /root/interfaces
echo "netmask $MASCARA" >> /root/interfaces
echo " "
echo " "
echo "auto $INTERFACE_EXTERNA" >> /root/interfaces
echo "iface $INTERFACE_EXTERNA inet dhcp" >> /root/interfaces

###################  configura a internet  ##########################################


db_fset config-fromti/internet seen true
db_input critical config-fromti/internet || true
db_go || true

db_get config-fromti/internet
echo "$RET"
case $RET in
Velox) pppoeconf ;;
Embratel) ipfixo $INTERFACE_INTERNA $INTERFACE_EXTERNA $IPINT $MASCARA;;
Jet) dhclient $INTERFACE_EXTERNA ;;
TVN) dhclient $INTERFACE_EXTERNA ;;
esac
echo "SAIU DA FUNCAO IPFIXO"

cp /root/interfaces /etc/network/interfaces
echo "COPIOU O ARQUIVO"
PID=$$
kill -9 $PID
exit

}

ipfixo ( ) {

db_fset config-fromti/gateway seen true
db_input critical config-fromti/gateway || true
db_go || true

db_get config-fromti/gateway
GATEWAY=$RET

db_fset config-fromti/mascara seen true
db_input critical config-fromti/mascara || true
db_go || true

db_get config-fromti/mascara
MASCARA_EXTERNA=$RET

db_fset config-fromti/ip-externo seen true
db_input critical config-fromti/ip-externo || true
db_go || true

db_get config-fromti/ip-externo
IP_EXTERNO=$RET

echo "auto lo" > /root/interfaces
echo "iface lo inet loopback" >> /root/interfaces
echo " " >> /root/interfaces
echo " " >> /root/interfaces
echo "auto $1" >> /root/interfaces
echo "iface $1 inet static" >> /root/interfaces
echo "        address $3" >> /root/interfaces
echo "        netmask $4" >> /root/interfaces
echo " "
echo " "
echo "auto $2" >> /root/interfaces
echo "iface $2 inet static" >> /root/interfaces
echo "        address    $IP_EXTERNO" >> /root/interfaces
echo "        netmask    $MASCARA_EXTERNA" >> /root/interfaces
echo "        gateway    $GATEWAY" >> /root/interfaces
echo "SAINDO DA FUNCAO IPFIXO"
}
Principal

Reply to: