Imported scripts from private repository and enforced the naming convention

This commit is contained in:
Michele Cereda
2022-03-04 00:09:59 +01:00
parent a02453cc47
commit b2a057281c
29 changed files with 104 additions and 20 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
interface="wlan0"
max_retries=3
timeout=1
log_path="$(dirname $0)/$(basename $0).log"
log_prefix="$(date +'%Y-%m-%d %T')"
i=0
until [ $i -eq $max_retries ]; do
let "i++"
if nc -Nz -w $timeout www.google.com 443; then
echo "$log_prefix" "connection is OK" >> $log_path
break
else
echo "$log_prefix" "no connection, resetting interface" >> $log_path
sudo ifconfig wlan0 down && sudo ifconfig wlan0 up
fi
done