Code: Select all
1 #!/bin/bash
2 sleep 5m
3 while true ; do
4 if ifconfig wlan0 | grep -q "inet addr:" ; then
5 sleep 5m
6 else
7 echo "Network connection down. Attempting reconnection."
8 ifup --force wlan0
9 sleep 2m
10 fi
11 doneCode: Select all
pi@xx:/usr/bin $ bash net_mgr.sh
Network connection down. Attempting reconnection.
ifup: unknown interface wlan0
^CCode: Select all
pi@xx:/usr/bin $ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65xxx
inet 127.x.x.x netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2 bytes 230 (230.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 230 (230.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
mon1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
unspec 00-DA-35-xx-xx-xx-xx-xx-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 274822 bytes 58167822 (55.4 MiB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:xx:xx:xx txqueuelen 1000 (Ethernet)
RX packets 6459 bytes 916894 (895.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2147 bytes 325456 (317.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
pi@xx:/usr/bin $ ifquery -l
lo
wlan1
wlan2
pi@xx:/usr/bin $ ifconfig -v wlan0 up
SIOCSIFFLAGS: Operation not permitted
WARNING: at least one error occured. (-1)I need some help in understanding why it appears I have wlan0 in some cases and not others. I need help to also understand why taking it down works, but bringing it up doesn't.
Here is the daemon.log for the first error reported in this post.
Code: Select all
Aug 21 09:59:10 pi systemd[1]: Started Session c2 of user pi.
Aug 21 10:22:05 pi systemd[1]: Reloading.
Aug 21 10:46:56 pi systemd[1]: Reloading.
Aug 21 11:09:53 pi dhcpcd[219]: wlan0: carrier lost
Aug 21 11:09:54 pi dhcpcd[219]: wlan0: deleting address fe80::fdaa:8445:xxxx:xxxx
Aug 21 11:09:54 pi avahi-daemon[236]: Withdrawing address record for fe80::fdaa:8445:xxxx:xxxx on wlan0.
Aug 21 11:09:54 pi avahi-daemon[236]: Leaving mDNS multicast group on interface wlan0.IPv6 with address fe80::fdaa:8445:xxxx:xxxx.
Aug 21 11:09:54 pi avahi-daemon[236]: Interface wlan0.IPv6 no longer relevant for mDNS.
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: deleting default route via 192.168.1.1
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: deleting route to 192.168.1.0/24
Aug 21 11:09:55 pi avahi-daemon[236]: Withdrawing address record for 192.168.x.x on wlan0.
Aug 21 11:09:55 pi avahi-daemon[236]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.x.x.
Aug 21 11:09:55 pi avahi-daemon[236]: Interface wlan0.IPv4 no longer relevant for mDNS.
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: carrier acquired
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: IAID eb:0d:xx:xx
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: adding address fe80::fdaa:8445:xxxx:xxxx
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: probing address 192.168.x.x/24
Aug 21 11:09:55 pi dhcpcd[219]: wlan0: soliciting an IPv6 router
Aug 21 11:09:56 pi avahi-daemon[236]: Joining mDNS multicast group on interface wlan0.IPv6 with address fe80::fdaa:8445:xxxx:xxxx.
Aug 21 11:09:56 pi avahi-daemon[236]: New relevant interface wlan0.IPv6 for mDNS.
Aug 21 11:09:56 pi avahi-daemon[236]: Registering new address record for fe80::fdaa:8445:xxxx:xxxx on wlan0.*.
Aug 21 11:09:58 pi dhcpcd[18075]: sending commands to master dhcpcd process
Aug 21 11:09:58 pi dhcpcd[219]: control command: /sbin/dhcpcd -k wlan0
Aug 21 11:09:58 pi dhcpcd[219]: wlan0: removing interface
Aug 21 11:10:00 pi avahi-daemon[236]: Interface wlan0.IPv6 no longer relevant for mDNS.
Aug 21 11:10:00 pi avahi-daemon[236]: Leaving mDNS multicast group on interface wlan0.IPv6 with address fe80::fdaa:8445:xxxx:xxxx.
Aug 21 11:10:00 pi avahi-daemon[236]: Withdrawing address record for fe80::fdaa:8445:xxxx:xxxx on wlan0.