hassio-addons/ot-recorder/run.sh

29 lines
638 B
Bash
Raw Normal View History

2018-11-21 21:35:56 +00:00
#!/bin/sh
set -e
CONFIG_PATH=/data/options.json
TOPICS=$(jq --raw-output ".topics" $CONFIG_PATH)
HOST=$(jq --raw-output ".host" $CONFIG_PATH)
PORT=$(jq --raw-output ".port" $CONFIG_PATH)
USER=$(jq --raw-output ".user" $CONFIG_PATH)
PASS=$(jq --raw-output ".pass" $CONFIG_PATH)
QOS=$(jq --raw-output ".qos" $CONFIG_PATH)
echo "
OTR_STORAGEDIR = \"/owntracks\"
OTR_TOPICS = \"$TOPICS\"
OTR_HOST = \"$HOST\"
OTR_PORT = $PORT
OTR_USER = \"$USER\"
OTR_PASS = \"$PASS\"
OTR_QOS = $QOS
" > /etc/ot-recorder.cfg
if [ ! -f /owntracks/ghash/data.mdb ] ; then
/usr/sbin/ot-recorder --initialize
fi
/usr/sbin/ot-recorder --http-host 0.0.0.0