docker_tools/sbin/docker_network_down

29 lines
612 B
Bash
Executable File

#!/bin/bash
#-------------------------------------------------------------------------------
set -o errexit
APPL_HOME_DIR="$(dirname "$(dirname "$0")")"
#-------------------------------------------------------------------------------
cd ${APPL_HOME_DIR}
. .env
if [[ "${NETWORK_TABLE}" != "" ]]
then
if [[ "$( ip rule list | grep "from ${NETWORK_ADDRESS}")" != "" ]]
then
ip rule del from ${NETWORK_ADDRESS}
fi
if [[ "$( ip route list table ${NETWORK_TABLE} | grep "${NETWORK_SUBNET}")" != "" ]]
then
ip route del ${NETWORK_SUBNET} table ${NETWORK_TABLE}
fi
fi