-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwlan-chk
More file actions
executable file
·38 lines (31 loc) · 810 Bytes
/
wlan-chk
File metadata and controls
executable file
·38 lines (31 loc) · 810 Bytes
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
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# If wlan loses connection restart
# depends: ifupdown swh curl avahi
func () {
tee /etc/systemd/system/wlan-chk.service <<EOF
[Unit]
Description=Wlan Check
ConditionFileIsExecutable=/usr/local/bin/wlan-chk
After=network.target network-online.target ifup@.service bluetooth.target
[Service]
Type=forking
ExecStart=/usr/local/bin/wlan-chk > /dev/null 2>&1
TimeoutSec=0
RemainAfterExit=yes
StandardOutput=journal+console
StandardError=journal+console
[Install]
WantedBy=multi-user.target
EOF
systemctl enable wlan-chk
}
# verbosity
#set -x
# allow 1 minute before running loop
sleep 60
# run loop
while true; do
service avahi-daemon restart # make sure avahi is available
if [[ `curl -I https://github.com 2>&1 | grep 'HTTP/2 200'` ]]; then sleep 300; else swh -r; sleep 300; fi
done
exit 0