33 lines
829 B
Bash
Executable file
33 lines
829 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
|
|
|
|
exec $DIRECTORY/tellusagent \
|
|
--connect-port ${CONNECT_PORT} \
|
|
--control-port ${CONTROL_PORT} \
|
|
--media-port ${MEDIA_PORT} \
|
|
--server-address ${SERVER_ADDRESS} \
|
|
--service-mode ${SERVICE_MODE}
|