From 35b9c74fe0a9aba9f201904ecefd5d6ba8484f05 Mon Sep 17 00:00:00 2001 From: Tobias Blomberg Date: Sat, 30 Dec 2017 17:08:55 +0100 Subject: [PATCH] Add systemd unit file for SvxReflector --- src/svxlink/systemd/CMakeLists.txt | 10 ++++++++++ src/svxlink/systemd/svxreflector.default.in | 11 +++++++++++ src/svxlink/systemd/svxreflector.service.in | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/svxlink/systemd/svxreflector.default.in create mode 100644 src/svxlink/systemd/svxreflector.service.in diff --git a/src/svxlink/systemd/CMakeLists.txt b/src/svxlink/systemd/CMakeLists.txt index 0c2c2c515..dc0f31cd6 100644 --- a/src/svxlink/systemd/CMakeLists.txt +++ b/src/svxlink/systemd/CMakeLists.txt @@ -20,6 +20,9 @@ configure_file(${SYSTEMD_SOURCE_DIR}/remotetrx.service.in ${PROJECT_BINARY_DIR}/systemd/remotetrx.service) #message(STATUS "Configured systemd unit file:remotetrx.service") +configure_file(${SYSTEMD_SOURCE_DIR}/svxreflector.service.in + ${PROJECT_BINARY_DIR}/systemd/svxreflector.service) + configure_file(${SYSTEMD_SOURCE_DIR}/svxlink.default.in ${PROJECT_BINARY_DIR}/systemd/svxlink) #message(STATUS "Configured systemd unit file:svxlink") @@ -28,12 +31,17 @@ configure_file(${SYSTEMD_SOURCE_DIR}/remotetrx.default.in ${PROJECT_BINARY_DIR}/systemd/remotetrx) #message(STATUS "Configured systemd unit file:remotetrx") +configure_file(${SYSTEMD_SOURCE_DIR}/svxreflector.default.in + ${PROJECT_BINARY_DIR}/systemd/svxreflector) + install(FILES ${PROJECT_BINARY_DIR}/systemd/svxlink_gpio_setup.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) install(FILES ${PROJECT_BINARY_DIR}/systemd/svxlink.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) install(FILES ${PROJECT_BINARY_DIR}/systemd/remotetrx.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) +install(FILES ${PROJECT_BINARY_DIR}/systemd/svxreflector.service + DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) message(STATUS "Systemd unit files will be installed to " "${SYSTEMD_CONFIGURATIONS_FILES_DIR} after make install") @@ -41,6 +49,8 @@ install(FILES ${PROJECT_BINARY_DIR}/systemd/svxlink DESTINATION ${SYSTEMD_DEFAULTS_FILES_DIR} ) install(FILES ${PROJECT_BINARY_DIR}/systemd/remotetrx DESTINATION ${SYSTEMD_DEFAULTS_FILES_DIR} ) +install(FILES ${PROJECT_BINARY_DIR}/systemd/svxreflector + DESTINATION ${SYSTEMD_DEFAULTS_FILES_DIR} ) message(STATUS "Systemd unit configuration files will be " "installed to ${SYSTEMD_DEFAULTS_FILES_DIR} " "after make install") diff --git a/src/svxlink/systemd/svxreflector.default.in b/src/svxlink/systemd/svxreflector.default.in new file mode 100644 index 000000000..d91d097f0 --- /dev/null +++ b/src/svxlink/systemd/svxreflector.default.in @@ -0,0 +1,11 @@ +############################################################################# +# +# Configuration file for the SvxReflector Systemd unit file +# +############################################################################# + +# The user to run the SvxReflector server as +RUNASUSER=@SVXLINK_USER@ + +# Specify which configuration file to use +CFGFILE=@SVX_SYSCONF_INSTALL_DIR@/svxreflector.conf diff --git a/src/svxlink/systemd/svxreflector.service.in b/src/svxlink/systemd/svxreflector.service.in new file mode 100644 index 000000000..dc9297985 --- /dev/null +++ b/src/svxlink/systemd/svxreflector.service.in @@ -0,0 +1,19 @@ +[Unit] +Description=SvxReflector SvxLink node linking software +Documentation=man:svxreflector(1) +After=network.target remote-fs.target syslog.target time.target + +[Service] +EnvironmentFile=/etc/default/svxreflector +PIDFile=/run/svxreflector.pid +ExecStartPre=-/bin/touch /var/log/svxreflector +ExecStartPre=-/bin/chown $RUNASUSER /var/log/svxreflector +ExecStart=/bin/sh -c '@BIN_INSTALL_DIR@/svxreflector --logfile=/var/log/svxreflector --config=$CFGFILE --pidfile=/run/svxreflector.pid --runasuser=$RUNASUSER' +ExecReload=/bin/kill -s HUP $MAINPID +Restart=on-failure +TimeoutStartSec=60 +LimitCORE=infinity +WorkingDirectory=@SVX_SYSCONF_INSTALL_DIR@ + +[Install] +WantedBy=multi-user.target