-
Notifications
You must be signed in to change notification settings - Fork 0
/
autorecon_eduroam.sh
executable file
·28 lines (26 loc) · 1.06 KB
/
autorecon_eduroam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#recon_eduroam
#Description: For some laptops, the eduroam wifi network keeps randomly stopping. This script reconnects your computer to eduroam network when pinging to google.com fails.
#To automatically launch this script after booting you can add it into your crontab.
#For example:
# @reboot sleep 30 && bash /home/user/Miscellaneous/autorecon_eduroam.sh
#In your crontab, the previous line will start autorecon_eduroam.sh 30 seconds after your laptop will have boot.
#This scripts depends on nmcli. Please install the package "network-manager" following these steps:
# sudo apt install network-manager;
# systemctl start NetworkManager.service;
# systemctl enable NetworkManager.service;
#Author: PAGEAUD Yoann - [email protected]
#Runs under Linux - Ubuntu 22.04
#This script is free of rights.
while true;
do
networkname=$(nmcli -t -f NAME c show --active);
sleep 1;
if [[ $networkname == "eduroam" ]]; then
# echo "$networkname";
if ! pingout=$(ping -c 1 google.com > /dev/null); then
# echo "Reconnecting...";
nmcli con up eduroam;
fi
fi
done