4
Fork 0
CronosAgent/cronosagent.sh
2016-08-02 08:21:44 +04:00

32 lines
868 B
Bash
Executable file

#!/bin/bash
if [ -f cronosagent.conf ]
then
# Read configuration from text file
source cronosagent.conf
fi
if [ -f /etc/config/brandmeister ]
then
# Read configuration from uCI/LuCI on OpenWRT
REPEATER_NUMBER=$(uci get cronosagent.@cronosagent[0].number)
REPEATER_ADDRESS=$(uci get cronosagent.@cronosagent[0].repeaterAddress)
SERVER_ADDRESS=$(uci get cronosagent.@cronosagent[0].serverAddress)
SERVER_PASSWORD=$(uci get cronosagent.@cronosagent[0].serverPassword)
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
./cronosagent \
--trap-port 8162 \
--repeater-number ${REPEATER_NUMBER} \
--repeater-address ${REPEATER_ADDRESS} \
--server-password ${SERVER_PASSWORD} \
--server-address ${SERVER_ADDRESS} \
--service-mode ${SERVICE_MODE}