mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-04 09:01:03 +03:00
51 lines
1017 B
Bash
Executable File
51 lines
1017 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 ] [ live | beta | dev ]"
|
|
}
|
|
|
|
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
|