From 96220e593ecc6735327305d1d3eedc87ebee6d76 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Sun, 21 Jul 2019 02:40:34 -0300 Subject: [PATCH] Add script to check if there is internet connection or restart mobprobe --- Services/fixInternetAfterSleep.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 Services/fixInternetAfterSleep.sh diff --git a/Services/fixInternetAfterSleep.sh b/Services/fixInternetAfterSleep.sh new file mode 100755 index 0000000..5a9de9b --- /dev/null +++ b/Services/fixInternetAfterSleep.sh @@ -0,0 +1,4 @@ +if ! ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then + modProbeNumber=$(sudo dmesg | grep -m1 "enp1s0: link down" | awk '{if ($2 ~ /r[0-9].*/) { col=$2 } else { col=$3 }; gsub(":", "", col); print col }') + sudo modprobe -r "$modProbeNumber" && sleep 10 && sudo modprobe "$modProbeNumber" +fi