initscripts/sbin/ifdown
silvan bf8757b8e2 - modify network into RedHat style to work with NetworkManager ifcfg-rh plugin:
* use /etc/sysconfig/network-scripts instead of /etc/sysconfig/network-devices
   * use ifcfg-* interface configuration files instead of ifconfig.*
2011-04-27 19:48:38 +02:00

30 lines
790 B
Bash

#!/bin/bash
# Copyright (c) 2003-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
DEVICE=${1}
[ "${DEVICE}" ] || exit 1
[ -r $network_devices/ifcfg-${DEVICE} ] &&
. $network_devices/ifcfg-${DEVICE}
if [ -x $network_devices/ifdown-${DEVICE} ]; then
$network_devices/ifdown-${DEVICE}
else
if [ -r /var/run/wpa_supplicant/${DEVICE} ]; then
wpa_cli -i${DEVICE} terminate >/dev/null
fi
if [ -r /var/run/dhclient.${DEVICE}.pid ]; then
/sbin/dhclient ${DEVICE} -r -pf /var/run/dhclient.${DEVICE}.pid
kill -9 `cat /var/run/dhclient.${DEVICE}.pid` 2>/dev/null
rm -f /var/run/dhclient.${DEVICE}.pid
fi
/sbin/ifconfig ${DEVICE} down
fi