b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / sbin /
Filename/sbin/ifdown
Size1.47 kb
Permissionrwxr-xr-x
Ownerapache
Create time23-Dec-2025 17:41
Last modified27-Apr-2018 16:28
Last accessed21-Apr-2026 19:30
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
#!/bin/bash

unset WINDOW # defined by screen, conflicts with our usage

. /etc/init.d/functions

cd /etc/sysconfig/network-scripts
. ./network-functions

[ -f ../network ] && . ../network

CONFIG=$1

[ -z "$CONFIG" ] && {
echo $"usage: ifdown <device name>" >&2
exit 1
}

need_config "${CONFIG}"

[ -f "$CONFIG" ] || {
echo $"usage: ifdown <device name>" >&2
exit 1
}

if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
source_config
if /usr/sbin/usernetctl ${CONFIG} report ; then
exec /usr/sbin/usernetctl ${CONFIG} down
fi
fi
echo $"Users cannot control this device." >&2
exit 1
fi

source_config

if [ -n "$IN_HOTPLUG" ] && [ "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ]
then
exit 0
fi

if [ "$USE_NM" = "true" ]; then
if [ -n "$UUID" -a -z "$DEVICE" ]; then
DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
fi
if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then
if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | egrep -q "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
nmcli dev disconnect iface "$DEVICE"
exit $?
fi
exit 0
fi
fi

if [ -x /sbin/ifdown-pre-local ]; then
/sbin/ifdown-pre-local ${DEVICE}
fi

OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}"

if [ ! -x ${OTHERSCRIPT} ]; then
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
fi

exec ${OTHERSCRIPT} ${CONFIG} $2