Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 13744  / 2 Years ago, fri, january 28, 2022, 4:17:52

I'm building a wireless photoframe. The one thing I haven't been able to figure out is how to get my wifi connection back up using a recommended method.



Right now I edited /etc/network/interfaces so wlan0 is started at boot:



auto wlan0
iface wlan0 inet dhcp
wireless-essid ourssid


This method works fine for booting. But I found that if I do not check the connection for a long time (could be a week) it might be down. So I should reconnect.



What I do now to verify the connection is working is downloading a file from the server that can't be cached (http://server.ext/ping.php?randomize=123456)
If I fail to retrieve the file I assume that the connection is no longer working and I run a shell script like



#!/bin/bash
ifconfig wlan0 up
iwconfig wlan0 essid "ourssid"
dhclient wlan0


And the connection comes back. But I can't find anything if this is in any way a good method.



Can this be improved upon, or is this already right?


More From » wireless

 Answers
0

ifup wlan0 should do all that for you automatically.



It reads the interfaces file and does everything that startup would do. You may have to run ifdown wlan0 first if ifup believes the interface is already up.



You could make a small script to try getting the file and then run ifup if it fails and cron it for every hour or two.


[#41745] Saturday, January 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antebrow

Total Points: 291
Total Questions: 135
Total Answers: 117

Location: New Caledonia
Member since Thu, Mar 23, 2023
1 Year ago
antebrow questions
;