Wiser ifdown-eth0 script is needed

Csaba Henk ekho at renyi.hu
Wed Oct 9 16:52:34 PDT 2002


 Hi!

BLFS-book v. 20021009, txt version, lines 6786-6793 (dhcp client
configuration):

cat > ifdown-eth0 << "EOF"
#!/bin/sh
source /etc/sysconfig/rc || exit
source $rc_functions || exit
source $network_devices/ifconfig.eth0 || exit
echo "Bringing down the eth0 interface..."
$DHCP_PROG $DHCP_STOP
evaluate_retval
EOF

-- I think writing this script this way is not too wise: when one shuts
down the system, processes like dhcpcd are killed at the "Sending all
processes the KILL/TERM signal" stage (runlevel 6?), so when this script
is to be executed, then there is no running dhcpcd (say DHCP_PROG=dhcpcd),
so the dhcpcd -k command (say DHCP_STOP=-k) returns with 1, and then the
evaluate_retval function gives the poor user that scary red error
message... And even if this situation would not occur, there is no
guarantee that dhcpcd was running prior to shutting down -- if it was not,
again a crash is reported... Maybe there should be written sg like

#...
if ps -C $DHCP_PROG
then
 $DHCP_PROG $DHCP_STOP
else
 true
fi
evaluate_retval
#EOF

Csaba Henk

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-dev' in the subject header of the message



More information about the blfs-dev mailing list