hassio-addons/ot-recorder/run.sh

33 lines
724 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 "
2018-11-22 09:10:59 +00:00
OTR_STORAGEDIR = \"/share/ot-recorder\"
2018-11-21 21:35:56 +00:00
OTR_TOPICS = \"$TOPICS\"
OTR_HOST = \"$HOST\"
OTR_PORT = $PORT
OTR_USER = \"$USER\"
OTR_PASS = \"$PASS\"
OTR_QOS = $QOS
" > /etc/ot-recorder.cfg
2018-11-22 09:10:59 +00:00
if [ ! -d /share/ot-recorder ] ; then
mkdir /share/ot-recorder
fi
if [ ! -f /share/ot-recorder/ghash/data.mdb ] ; then
2018-11-21 21:35:56 +00:00
/usr/sbin/ot-recorder --initialize
fi
/usr/sbin/ot-recorder --http-host 0.0.0.0