EDDN/contrib/systemd/start-eddn-service
Athanasius 086493b5bf Make it possible to split dev and live installs
* Have 'dev' and 'live' components to many paths and file names.
* Have separate dev/live systemd start script configs.
* Have the systemd start script take a dev/live second argument.
* Try to ensure permissions on 'web' files by explicitly setting umask.
2021-07-01 16:52:25 +00:00

51 lines
1010 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.
usage() {
echo "Usage: $(basename $0) [ gateway | monitor | relay ] [ dev | live ]"
}
if [ -z "${1}" ];
then
usage
echo "No EDDN service specified."
exit 3
fi
SERVICE="${1}"
if [ -z "${2}" ];
then
usage
echo "No EDDN environment specified."
exit 3
fi
EDDN_ENV="${2}"
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_${EDDN_ENV}_config" ];
then
echo "eddn_${EDDN_ENV}_config is missing from $(pwd)"
exit 1
fi
. "./eddn_${EDDN_ENV}_config"
# Use the python venv
. "${PYTHON_VENV}/bin/activate"
if [ ! -f "${PYTHON_VENV}/bin/eddn-${SERVICE}" ];
then
echo "${SERVICE} is missing from ${PYTHON_VENV}/bin"
exit 2
fi
exec ${PYTHON_VENV}/bin/eddn-${SERVICE} --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/${SERVICE}.log" 2>&1