-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from kasitoru/dev
Dev
- Loading branch information
Showing
5 changed files
with
100 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
GATEWAY=${1:-"192.168.1.1"} | ||
|
||
errors=0 | ||
while true; do | ||
# Network connection | ||
if ! ping -c 1 $GATEWAY &> /dev/null; then | ||
echo "Reconnecting to an Access Point..." | ||
killall udhcpc wpa_supplicant | ||
ifconfig wlan0 down | ||
ifconfig wlan0 up | ||
wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf | ||
udhcpc -b -i wlan0 | ||
errors=$((errors+1)) | ||
else | ||
errors=0 | ||
fi | ||
# Main application | ||
if ! killall -0 mjsxj02hl &> /dev/null; then | ||
echo "Restarting main application..." | ||
mjsxj02hl & | ||
errors=$((errors+1)) | ||
else | ||
errors=0 | ||
fi | ||
# Reboot if there are many errors | ||
if [ $errors -ge 5 ]; then | ||
echo "Too many errors! Rebooting the device..." | ||
reboot | ||
fi | ||
sleep 10 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
# coding=utf-8 | ||
|
||
import os | ||
|