mirror of
https://github.com/EDCD/EDDN.git
synced 2026-10-22 20:42:10 +03:00
systemd: Change to a single script for starting services
* Pass the EDDN service to be started as $1. * eddn_config now defines a python venv activate script to use. * And this new central script uses that.
This commit is contained in:
1 parent
165a00599f
commit
415f5bb17d
6 files changed
+39
-49
No files matched your search
@@ -18,7 +18,7 @@ After=network.target
|
||||
Type=simple
|
||||
User=eddn
|
||||
Group=eddn
|
||||
ExecStart=/home/eddn/.local/bin/start-%i
|
||||
ExecStart=/home/eddn/.local/bin/start-eddn-service %i
|
||||
TimeoutStartSec=10s
|
||||
TimeoutStopSec=10s
|
||||
SyslogIdentifier=eddn@%i
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
CONFIG_OVERRIDE="${HOME}/.local/share/eddn/config.json"
|
||||
LOG_DIR="${HOME}/.var/log/eddn"
|
||||
PYTHON_VENV_ACTIVATE="${HOME}/eddn/python2.7-venv/bin/activate"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
# vim: tabstop=2 shiftwidth=2 textwidth=0 wrapmargin=0 expandtab
|
||||
#
|
||||
# Start the EDDN Gateway, including redirecting output to a log file.
|
||||
|
||||
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
|
||||
. ./eddn_config
|
||||
|
||||
./eddn-gateway --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/eddn-gateway.log" 2>&1
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
# vim: tabstop=2 shiftwidth=2 textwidth=0 wrapmargin=0 expandtab
|
||||
#
|
||||
# Start the EDDN Gateway, including redirecting output to a log file.
|
||||
|
||||
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
|
||||
. ./eddn_config
|
||||
|
||||
./eddn-monitor --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/eddn-monitor.log" 2>&1
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
# vim: tabstop=2 shiftwidth=2 textwidth=0 wrapmargin=0 expandtab
|
||||
#
|
||||
# Start the EDDN Gateway, including redirecting output to a log file.
|
||||
|
||||
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
|
||||
. ./eddn_config
|
||||
|
||||
./eddn-relay --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/eddn-relay.log" 2>&1
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash -x
|
||||
# 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_ACTIVATE}"
|
||||
|
||||
if [ ! -f eddn-${SERVICE} ];
|
||||
then
|
||||
echo "eddn-${SERVICE} is missing from $(pwd)"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
./eddn-${SERVICE} --config "${CONFIG_OVERRIDE}" >> "${LOG_DIR}/eddn-${SERVICE}.log" 2>&1
|
||||
Reference in new issue
Block a user