Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'starwisp_lib' of github.com:nebogeo/mongoose-web into s…
…tarwisp_lib
- Loading branch information
Showing
13 changed files
with
164 additions
and
21 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
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,12 @@ | ||
import smbus | ||
import os | ||
|
||
bus = smbus.SMBus(1) | ||
|
||
# if we are on battery power | ||
if bus.read_byte_data(0x69,0)==2: | ||
# "unconditional file safe shutdown and power OFF when battery powered" | ||
bus.write_byte_data(0x6b,0x00,0xcc) | ||
|
||
# shut down nicely | ||
#os.system("sudo halt") |
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,25 @@ | ||
#!/bin/bash | ||
create_ssh_tunnel() { | ||
/usr/bin/ssh -o "ExitOnForwardFailure yes" -N -R 2222:localhost:22 mongoose@be.fo.am & | ||
if [[ $? -eq 0 ]]; then | ||
echo SSH tunnel created successfully | ||
else | ||
echo An error occurred creating SSH tunnel. RC was $? | ||
fi | ||
} | ||
create_rabbit_tunnel() { | ||
/usr/bin/ssh -o "ExitOnForwardFailure yes" -N -R 5672:localhost:5672 mongoose@be.fo.am & | ||
if [[ $? -eq 0 ]]; then | ||
echo Rabbit tunnel created successfully | ||
else | ||
echo An error occurred creating a RabbitMQ tunnel. RC was $? | ||
fi | ||
} | ||
|
||
/bin/pidof ssh | ||
if [[ $? -ne 0 ]]; then | ||
echo Creating new ssh tunnel connection | ||
create_ssh_tunnel | ||
echo Creating new RabbitMQ tunnel connection | ||
create_rabbit_tunnel | ||
fi |
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,34 @@ | ||
# Edit this file to introduce tasks to be run by cron. | ||
# | ||
# Each task to run has to be defined through a single line | ||
# indicating with different fields when the task will be run | ||
# and what command to run for the task | ||
# | ||
# To define the time you can provide concrete values for | ||
# minute (m), hour (h), day of month (dom), month (mon), | ||
# and day of week (dow) or use '*' in these fields (for 'any').# | ||
# Notice that tasks will be started based on the cron's system | ||
# daemon's notion of time and timezones. | ||
# | ||
# Output of the crontab jobs (including errors) is sent through | ||
# email to the user the crontab file belongs to (unless redirected). | ||
# | ||
# For example, you can run a backup of all your user accounts | ||
# at 5 a.m every week with: | ||
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ | ||
# | ||
# For more information see the manual pages of crontab(5) and cron(8) | ||
# | ||
# m h dom mon dow command | ||
|
||
@reboot supervise /home/pi/mongoose-2000/web | ||
|
||
# adding path so we can find dotnet etc | ||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
|
||
@reboot ~/datapipe.sh | ||
*/1 * * * * ~/create_tunnel.sh > tunnel.log 2>&1 | ||
*/1 * * * * python ~/battery_detect.py | ||
|
||
@reboot sleep 15 && ~/start_adhoc.sh >> hostapd.log 2>&1 | ||
@reboot sleep 30 && ~/start_adhoc.sh >> hostapd.log 2>&1 |
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,3 @@ | ||
#!/bin/bash | ||
cd mongoose-2000/dotnet/datpipe/ | ||
dotnet ./DataPipe.Main.dll |
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,23 @@ | ||
# interfaces(5) file used by ifup(8) and ifdown(8) | ||
|
||
# Please note that this file is written to be used with dhcpcd | ||
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' | ||
|
||
# Include files from /etc/network/interfaces.d: | ||
source-directory /etc/network/interfaces.d | ||
|
||
auto lo | ||
iface lo inet loopback | ||
|
||
iface eth0 inet manual | ||
|
||
allow-hotplug wlan0 | ||
iface wlan0 inet static | ||
address 192.168.2.1 | ||
netmask 255.255.255.0 | ||
network 192.168.2.0 | ||
broadcast 192.168.1.255 | ||
|
||
allow-hotplug wlan1 | ||
iface wlan1 inet manual | ||
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf |
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,9 @@ | ||
#!/bin/bash | ||
sudo ifconfig wlan0 up | ||
sleep 5 | ||
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf & | ||
sleep 5 | ||
sudo ifconfig wlan0 up | ||
sleep 5 | ||
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf & | ||
|
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 @@ | ||
#!/bin/bash | ||
./server.scm 8888 >>client/htdocs/log.txt 2>&1 | ||
./server.scm 8888 >client/htdocs/log.txt 2>&1 | ||
|
||
|
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