Last active
August 29, 2015 14:24
-
-
Save vaijab/3b3001cf70a7e8abe3f5 to your computer and use it in GitHub Desktop.
BTWifi auto login
This file contains 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
[Unit] | |
Description=BT Wifi auto login hack | |
After=network.target | |
[Service] | |
Restart=always | |
RestartSec=30 | |
ExecStart=/home/vaijab/bin/btwifi_autologin.sh | |
[Install] | |
WantedBy=multi-user.target |
This file contains 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 | |
function check_connection() { | |
nmcli connection show --active | grep wlp0s18f2u2 | grep -q BTWi | |
if [[ $? != 0 ]]; then | |
return 1 | |
fi | |
ping -c3 -q google.co.uk 1> /dev/null | |
if [[ $? != 0 ]]; then | |
return 2 | |
fi | |
return 0 | |
} | |
while true; do | |
check_connection | |
status=$? | |
if [[ ${status} == 0 ]]; then | |
echo "Connection is already up, nothing to do." | |
elif [[ ${status} == 2 ]]; then | |
screen -d -m lynx -cmd_script=/home/vaijab/btwifi_autologin_lynx.log -accept_all_cookies -nocolor https://www.btopenzone.com:8443 | |
fi | |
echo "Sleeping for 30s." | |
sleep 30s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment