Last active
November 6, 2017 20:03
-
-
Save ABalanuta/cb11dab8af0056a6d9225e8d69a2b993 to your computer and use it in GitHub Desktop.
lora-gateway-bridge configuration files for the MultiTech Conduit: https://github.com/OpenChirp/docs/wiki/Multitech-Conduit/
This file contains hidden or 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
# ip:port to bind the UDP listener to (default: "0.0.0.0:1700") | |
UDP_BIND=127.0.0.1:1700 | |
# mqtt server (e.g. scheme://host:port where scheme is tcp, ssl or ws) (default: "tcp://127.0.0.1:1883") | |
MQTT_SERVER=tls://openchirp.andrew.cmu.edu:1883 | |
# mqtt prefix | |
MQTT_PREFIX="<your_openchirp_device_endpoint>" | |
# mqtt server username (optional) | |
MQTT_USERNAME=<your_openchirp_device_id> | |
# mqtt server password (optional) | |
MQTT_PASSWORD=<your_openchirp_device_generated_token> | |
# debug=5, info=4, warning=3, error=2, fatal=1, panic=0 (default: 4) | |
LOG_LEVEL=4 | |
# skip the CRC status-check of received packets | |
# SKIP_CRC_CHECK=true |
This file contains hidden or 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
#!/usr/bin/env bash | |
### BEGIN INIT INFO | |
# Provides: lora-gateway-bridge | |
# Required-Start: $all | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: LoRa Gateway Bridge abstracts the packet_forwarder protocol into JSON over MQTT | |
### END INIT INFO | |
# set variables for exporting (needed for DEFAULT_FILE) | |
set -a | |
NAME=lora-gateway-bridge | |
DESC="LoRa Gateway Bridge" | |
DAEMON_USER=root | |
DAEMON_GROUP=root | |
DAEMON=/opt/lora/$NAME | |
PID_FILE=/var/run/$NAME.pid | |
DEFAULT_FILE=/etc/default/$NAME | |
# check root | |
if [ "$UID" != "0" ]; then | |
echo "You must be root to run this script" | |
exit 1 | |
fi | |
# check daemon | |
if [ ! -x $DAEMON ]; then | |
echo "Executable $DAEMON does not exist" | |
exit 5 | |
fi | |
if [ -r /etc/default/rcS ]; then | |
. /etc/default/rcS | |
fi | |
if [ -f "$DEFAULT_FILE" ]; then | |
. "$DEFAULT_FILE" | |
fi | |
function do_start { | |
/usr/sbin/start-stop-daemon --start --background --chuid "$DAEMON_USER:$DAEMON_GROUP" --make-pidfile --pidfile "$PID_FILE" --startas /bin/bash -- -c "exec $DAEMON > /var/log/$NAME.log 2>&1" | |
} | |
function do_stop { | |
/usr/sbin/start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile "$PID_FILE" | |
sleep 1 | |
} | |
case "$1" in | |
start) | |
echo "Starting $DESC" | |
do_start | |
;; | |
stop) | |
echo "Stopping $DESC" | |
do_stop | |
;; | |
restart) | |
echo "Restarting $DESC" | |
do_stop | |
do_Start | |
;; | |
*) | |
echo "Usage: $NAME {start|stop|restart}" >&2 | |
exit 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment