3
Fork 0
TellusAgent/tellusagent.sh
Artem Prilutskiy 12ffb10726 Initial import
2016-11-01 12:17:27 +03:00

34 lines
824 B
Bash
Executable file

#!/bin/sh
DIRECTORY=$(dirname $0)
if [ -f $DIRECTORY/tellusagent.conf ]
then
# Read configuration from text file
# Dot is equivalent of bash's source
. $DIRECTORY/tellusagent.conf
fi
if [ -f /etc/config/tellusagent ]
then
# Read configuration from UCI/LuCI on OpenWRT
CONNECT_PORT=$(uci get tellusagent.@tellusagent[0].connectPort)
CONTROL_PORT=$(uci get tellusagent.@tellusagent[0].controlPort)
MEDIA_PORT=$(uci get tellusagent.@tellusagent[0].mediaPort)
fi
if [ -n "$1" ]
then
# 1 - print to standard output
# 2 - print to system log
# 6 - run as daemon and print to system log
SERVICE_MODE=$1
fi
$DIRECTORY/tellusagent \
--connect-port ${CONNECT_PORT} \
--control-port ${CONTROL_PORT} \
--media-port ${MEDIA_PORT} \
--server-address ${SERVER_ADDRESS} \
--service-mode ${SERVICE_MODE}