Last active
November 6, 2017 20:03
-
-
Save ABalanuta/cb11dab8af0056a6d9225e8d69a2b993 to your computer and use it in GitHub Desktop.
Revisions
-
ABalanuta revised this gist
Nov 6, 2017 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,16 @@ 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 -
ABalanuta revised this gist
Sep 7, 2017 . No changes.There are no files selected for viewing
-
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 4 additions and 19 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -54,31 +54,16 @@ case "$1" in 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 -
ABalanuta revised this gist
Sep 7, 2017 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ 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 -
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 5 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,8 @@ 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=/var/config/lora/$NAME.conf @@ -31,9 +31,6 @@ if [ ! -x $DAEMON ]; then exit 5 fi if [ -r /etc/default/rcS ]; then . /etc/default/rcS fi @@ -43,32 +40,22 @@ if [ -f "$DEFAULT_FILE" ]; then 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) log_daemon_msg "Stopping $DESC" do_stop ;; restart) log_daemon_msg "Restarting $DESC" -
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,9 +15,9 @@ NAME=lora-gateway-bridge DESC="LoRa Gateway Bridge" DAEMON_USER=gatewaybridge DAEMON_GROUP=gatewaybridge DAEMON=/opt/lora/$NAME PID_FILE=/var/run/$NAME.pid DEFAULT_FILE=/var/config/lora/$NAME.conf # check root if [ "$UID" != "0" ]; then @@ -43,11 +43,11 @@ if [ -f "$DEFAULT_FILE" ]; then 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/$NAME.log 2>&1" } function do_stop { /usr/sbin/start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile "$PID_FILE" --name "$NAME" retval="$?" sleep 1 return "$retval" -
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ # 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=ssl://openchirp.io:1883 # mqtt server username (optional) MQTT_USERNAME=< required > # mqtt server password (optional) MQTT_PASSWORD=< required > # debug=5, info=4, warning=3, error=2, fatal=1, panic=0 (default: 4) LOG_LEVEL=4 -
ABalanuta revised this gist
Sep 7, 2017 . No changes.There are no files selected for viewing
-
ABalanuta revised this gist
Sep 7, 2017 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # ip:port to bind the UDP listener to (default: "0.0.0.0:1700") UDP_BIND=0.0.0.0:1700 # mqtt server (e.g. scheme://host:port where scheme is tcp, ssl or ws) (default: "tcp://127.0.0.1:1883") MQTT_SERVER=tcp://127.0.0.1:1883 # mqtt server username (optional) MQTT_USERNAME= # mqtt server password (optional) MQTT_PASSWORD= # 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 -
ABalanuta revised this gist
Sep 7, 2017 . No changes.There are no files selected for viewing
-
ABalanuta revised this gist
Sep 7, 2017 . No changes.There are no files selected for viewing
-
ABalanuta created this gist
Sep 7, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,97 @@ #!/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=gatewaybridge DAEMON_GROUP=gatewaybridge DAEMON=/usr/bin/$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 # load functions and settings . /lib/lsb/init-functions if [ -r /etc/default/rcS ]; then . /etc/default/rcS fi if [ -f "$DEFAULT_FILE" ]; then . "$DEFAULT_FILE" fi function do_start { start-stop-daemon --start --background --chuid "$DAEMON_USER:$DAEMON_GROUP" --make-pidfile --pidfile "$PID_FILE" --startas /bin/bash -- -c "exec $DAEMON > /var/log/$NAME/$NAME.log 2>&1" } function do_stop { start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile "$PID_FILE" --name "$NAME" retval="$?" sleep 1 return "$retval" } case "$1" in start) log_daemon_msg "Starting $DESC" do_start case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) log_daemon_msg "Stopping $DESC" do_stop case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; restart) log_daemon_msg "Restarting $DESC" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; *) log_end_msg 1 ;; esac ;; *) log_end_msg 1 ;; esac ;; status) status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME" && exit 0 || exit $? ;; *) echo "Usage: $NAME {start|stop|restart|status}" >&2 exit 3 ;; esac