-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrestorewlan.sh
More file actions
22 lines (20 loc) · 768 Bytes
/
Copy pathrestorewlan.sh
File metadata and controls
22 lines (20 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# This script checks if you are connected to your router.
# To make it run periodically in the background you need to do
# the following:
#
# Create cronjob as root by entering 'sudo crontab -e' and copying
# the following line to the end of the file (without the '#'):
#
# */5 * * * * sh /home/pi/Downloads/EnviroPi/restorewlan.sh
#
# NOTES: 1) You might need to adjust the path to 'restorewlan.sh'
# 2) You might need to adjust the IP below to the one of your router
# 3) You might need to make the script executable (chmod +x restorewlan.sh)
# If routers IP cannot be pinged restart wlan0
if ! [ "$(ping -c 1 192.168.0.1)" ]; then
echo "WLAN DOWN - RESTARTING INTERFACE"
sudo ifdown --force wlan0
sudo ifup wlan0
fi
echo "WLAN SEEMS OK"