Skip to content

Instantly share code, notes, and snippets.

@vaijab
Last active August 29, 2015 14:24
Show Gist options
  • Save vaijab/3b3001cf70a7e8abe3f5 to your computer and use it in GitHub Desktop.
Save vaijab/3b3001cf70a7e8abe3f5 to your computer and use it in GitHub Desktop.
BTWifi auto login
[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
#!/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