From e8c3911b475c46f309b835a17dc0479926e77efe Mon Sep 17 00:00:00 2001 From: pgrondek Date: Fri, 24 Jul 2020 02:08:04 +0200 Subject: [PATCH] Update router script --- roles/router/files/monitor.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/roles/router/files/monitor.sh b/roles/router/files/monitor.sh index ca40a22..000b3da 100755 --- a/roles/router/files/monitor.sh +++ b/roles/router/files/monitor.sh @@ -25,6 +25,16 @@ function debug() { fi } +function interfaceDown() { + interface=$1 + ip link set dev ${interface} down +} + +function interfaceUp() { + interface=$1 + ip link set dev ${interface} down +} + function soft_restart() { if [[ ${DISABLE_SOFT_RESTART} ]] ; then return @@ -34,13 +44,13 @@ function soft_restart() { release dhcp interface ${WAN} debug "Disabling ${WAN} interface" - set interfaces ethernet ${WAN} disable + interfaceDown ${WAN} debug "Waiting ${SOFT_WAIT_TIME}" sleep ${SOFT_WAIT_TIME} debug "Enabling ${WAN} interface" - set interfaces ethernet ${WAN} enable + interfaceUp ${WAN} debug "Renewing DHCP IP lease on ${WAN}" renew dhcp interface ${WAN} @@ -54,7 +64,7 @@ function hard_restart() { release dhcp interface ${WAN} debug "Disabling ${WAN} interface" - set interfaces ethernet ${WAN} disable + interfaceDown ${WAN} debug "Turning off router outlet" ${RESET_MODEM_SCRIPT} -t ${OUTLET_IP} -c off >> /dev/null 2>&1 @@ -69,7 +79,7 @@ function hard_restart() { sleep ${MODEM_RESET_WAIT_TIME} debug "Enabling ${WAN} interface" - set interfaces ethernet ${WAN} enable + interfaceUp ${WAN} debug "Renewing DHCP IP lease on ${WAN}" renew dhcp interface ${WAN}