EDDN/contrib/systemd/start-eddn-service

38 lines
794 B
Bash
Executable File

#!/bin/sh
# vim: tabstop=2 shiftwidth=2 textwidth=0 wrapmargin=0 expandtab
#
# Start an EDDN Service, including redirecting output to a log file.
if [ -z "${1}" ];
then
echo "No EDDN service specified. One of: ${SERVICE}, monitor, relay"
exit 3
fi
SERVICE="${1}"
EXEC_PATH=$(dirname $0)
#echo "EXEC_PATH: ${EXEC_PATH}"
# Ensure we're in the correct place
cd ${EXEC_PATH}
#pwd
# Bring in some common configuration
if [ ! -f eddn_config ];
then
echo "eddn_config is missing from $(pwd)"
exit 1
fi
. ./eddn_config
# Use the python venv
. "${PYTHON_VENV}/bin/activate"
if [ ! -f "${PYTHON_VENV}/bin/${SERVICE}" ];
then
echo "${SERVICE} is missing from ${PYTHON_VENV}/bin"
exit 2
fi
${PYTHON_VENV}/bin/${SERVICE} --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/${SERVICE}.log" 2>&1