Skip to content

Instantly share code, notes, and snippets.

@allyunion
Created June 28, 2023 08:31
Show Gist options
  • Save allyunion/36d4eb59154826bee9213105297559cd to your computer and use it in GitHub Desktop.
Save allyunion/36d4eb59154826bee9213105297559cd to your computer and use it in GitHub Desktop.
#!/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