My unit keeps working well and delivering data for about two to three weeks. Then - and for no obvious reason it is no longer connected neither to the internet server nor locally. I’m using a WiFi dongle. Rebooting the unit usually resolved the problem.
Is there a way to setup a watchdog timer that reboots the unit regularly or on loss of connection?
The “softest” way of doing this in terms of hardware wear and tear is to simply check to see whether the unit can see the internet and restart the WiFi interface if not. I would try this route first because if it works, you won’t need a hard restart. This script is a good example: https://github.com/dweeber/WiFi_Check/blob/master/WiFi_Check
To install:
- SSH into the Shake and do the following. First, download the script:
git clone https://github.com/dweeber/WiFi_Check/
- Then, make sure your WiFi interface is called
wlan0
using theiwconfig
command. If it is wlan0, your output will look like the following:
$ iwconfig
vethb4b2a83 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"linksys" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.462 GHz Access Point: 58:6D:8F:7D:3B:27
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=81/100 Signal level=45/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
veth5d646c0 no wireless extensions.
docker0 no wireless extensions.
lo no wireless extensions.
vethe906781 no wireless extensions.
eth0 no wireless extensions.
- You will need to edit line 36 of the script. If your interface is named something other than
wlan0
, you will also need to edit line 38. Open it in the nano editor:
nano WiFi_Check/WiFi_Check
And change those lines to something like this:
# line 36:
lockfile='/home/myshake/WiFi_Check/WiFi_Check.pid'
# line 38:
wlan='wlan0' # <-- verify that this is the correct name of your wifi interface
Then save with Ctrl+O and Enter, and exit with Ctrl+X.
- After you’ve edited the script, make it executable, then open up your crontab file:
chmod +x WiFi_Check/WiFi_Check # adding the executable flag
EDITOR=nano crontab -e # if you don't use nano, pick your favorite editor
- Paste the following into your crontab:
# the following line runs the wifi check script every 5 minutes
*/5 * * * * /bin/bash /home/myshake/WiFi_Check/WiFi_Check
- Then save and exit with the same keystrokes Ctrl+O and Enter, and Ctrl+X.
Your Shake should now check on the status of the connection every 5 minutes, and restart the interface if the connection is lost. If you still notice problems, we can work on a version that restarts instead.
hi,
can you send along your log files, please? i’d like to have a look to see if there’s any specific information there that might point to what’s going wrong.
thanks in advance,
richard