PHP 7.4.33
Preview: ifdown Size: 2.07 KB
//etc/sysconfig/network-scripts/ifdown

#!/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 <configuration>" >&2
    exit 1
}

if ! [ -f /etc/sysconfig/disable-deprecation-warnings ] && ! is_true ${DEPRECATION_WARNING_ISSUED}; then
    net_log $"You are using 'ifdown' script provided by 'network-scripts', which are now deprecated." warning ifdown >&2
    net_log $"'network-scripts' will be removed in one of the next major releases of RHEL." warning ifdown >&2
    net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifdown >&2
fi

need_config "${CONFIG}"

[ -f "$CONFIG" ] || {
    echo $"usage: ifdown <configuration>" >&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,device con show --active | 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 | grep -Eq "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
            nmcli dev disconnect "$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-${TYPE}"
fi

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

exec ${OTHERSCRIPT} ${CONFIG} $2

Directory Contents

Dirs: 0 × Files: 34

Name Size Perms Modified Actions
607 B lrw-r--r-- 2025-01-07 20:32:36
Edit Download
254 B lrw-r--r-- 2022-08-10 13:03:37
Edit Download
2.07 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
646 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
6.27 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
769 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
4.43 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
769 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
2.02 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
870 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
1.42 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
1.58 KB lrwxr-xr-x 2020-07-26 09:58:14
Edit Download
1.52 KB lrwxr-xr-x 2020-07-26 09:58:14
Edit Download
1.43 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
5.33 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
11.98 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
906 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
13.45 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
11.79 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
11.61 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
11.79 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
643 B lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
1.03 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
4.88 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
2.37 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
3.23 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
1.71 KB lrwxr-xr-x 2020-07-26 09:58:14
Edit Download
1.83 KB lrwxr-xr-x 2020-07-26 09:58:14
Edit Download
2.81 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
1.79 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
5.29 KB lrwxr-xr-x 2022-08-10 13:03:37
Edit Download
19.95 KB lrw-r--r-- 2022-08-10 13:03:37
Edit Download
30.31 KB lrw-r--r-- 2022-08-10 13:03:37
Edit Download
54 B lrw-r--r-- 2025-01-07 20:32:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).