Download and run cayenne script in foreground
This commit is contained in:
parent
16cf0bc3e0
commit
094756c414
@ -31,6 +31,8 @@
|
|||||||
Forward packets with a valid CRC.
|
Forward packets with a valid CRC.
|
||||||
* GW_ANTENNA_GAIN optional - default 0.
|
* GW_ANTENNA_GAIN optional - default 0.
|
||||||
Set this to the dBd gain of your antenna. The dBd value is the dBi value minus 2.15dB, ie. dBd = dBi-2.15. This is used to reduce the TX power of the concentrator to stay within the legal limits.
|
Set this to the dBd gain of your antenna. The dBd value is the dBi value minus 2.15dB, ie. dBd = dBi-2.15. This is used to reduce the TX power of the concentrator to stay within the legal limits.
|
||||||
|
* CAYENNE_SCRIPT optional
|
||||||
|
When this variable is set to a Raspberry Pi Cayenne monitoring script, the script will be downloaded and executed. This allows monitoring of your gateway on Cayenne.
|
||||||
|
|
||||||
##Server variables
|
##Server variables
|
||||||
All server variables are optional, but when a server is enabled, it is recommended to set all variables to configure it completely.
|
All server variables are optional, but when a server is enabled, it is recommended to set all variables to configure it completely.
|
||||||
|
17
run.py
17
run.py
@ -7,6 +7,7 @@ Based on: https://github.com/rayozzie/ttn-resin-gateway-rpi/blob/master/run.sh
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
|
import stat
|
||||||
import urllib2
|
import urllib2
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@ -273,7 +274,21 @@ with open('global_conf.json', 'w') as the_file:
|
|||||||
the_file.write(json.dumps(local_conf, indent=4))
|
the_file.write(json.dumps(local_conf, indent=4))
|
||||||
|
|
||||||
|
|
||||||
# TODO: Cayenne monitoring script
|
# Cayenne monitoring script
|
||||||
|
"""
|
||||||
|
wget https://cayenne.mydevices.com/dl/rpi_lv7d88b029.sh
|
||||||
|
sudo bash rpi_lv7d88b029.sh -v
|
||||||
|
"""
|
||||||
|
if(os.environ.get("CAYENNE_SCRIPT")!=None):
|
||||||
|
try:
|
||||||
|
response = urllib2.urlopen(os.environ.get("CAYENNE_SCRIPT"), timeout=30)
|
||||||
|
cayenne_script = response.read()
|
||||||
|
with open('rpi_cayenne.sh', 'w') as the_file:
|
||||||
|
the_file.write(cayenne_script)
|
||||||
|
os.chmod('rpi_cayenne.sh', stat.S_IEXEC)
|
||||||
|
subprocess.call(["./rpi_cayenne.sh"])
|
||||||
|
except urllib2.URLError as err:
|
||||||
|
print ("Unable to fetch Cayenne script")
|
||||||
|
|
||||||
|
|
||||||
# Endless loop to reset and restart packet forwarder
|
# Endless loop to reset and restart packet forwarder
|
||||||
|
Loading…
Reference in New Issue
Block a user