Created
June 28, 2023 08:31
-
-
Save allyunion/36d4eb59154826bee9213105297559cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INTERFACE="wlan0" | |
GATEWAY=$(ip r | grep default | awk '{print $3}') | |
TEST_NETWORK=$(ping -c 1 ${GATEWAY} &> /dev/null; echo $?) | |
if [[ $test_network -ne 0 ]] | |
then | |
ifdown ${INTERFACE} | |
sleep 10 | |
ifup --force ${INTERFACE} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment