From 0161d4879f4dcb7d2e271e5e5f5438043a3e56f2 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sat, 19 Feb 2022 16:58:20 +0100 Subject: [PATCH] #20 add systemd stuff for time server --- DGWTimeServer/Makefile | 14 ++++++++++++++ debian/dgwtimeserver.service | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 debian/dgwtimeserver.service diff --git a/DGWTimeServer/Makefile b/DGWTimeServer/Makefile index 4ea197d..1212731 100644 --- a/DGWTimeServer/Makefile +++ b/DGWTimeServer/Makefile @@ -17,6 +17,20 @@ install: dgwtimeserver # copy executable @cp -f dgwtimeserver $(BIN_DIR) +# copy and adjust config + @cp -fn example.cfg $(CFG_DIR)/dgwtimeserver.cfg + @sed -i "s|path=/var/log/dstargateway/|path=$(LOG_DIR)|g" $(CFG_DIR)/dgwtimeserver.cfg + @sed -i "s|data=/usr/local/share/dstargateway.d/|data=$(DATA_DIR)|g" $(CFG_DIR)/dgwtimeserver.cfg + +# SystemD service install + @cp -f ../debian/dgwtimeserver.service /lib/systemd/system/ + @sed -i "s|%CFG_DIR%|$(CFG_DIR)|g" /lib/systemd/system/dgwtimeserver.service + systemctl enable dgwtimeserver.service + @systemctl daemon-reload + @echo "\n" + @echo "DGWTimeserver Install complete, edit $(CFG_DIR)dstargateway.cfg and start the daemon with 'systemctl start dgwtimeserver.service'" + @echo "\n" + ../BaseCommon/BaseCommon.a: ../DStarBase/DStarBase.a: ../VersionInfo/GitVersion.h: diff --git a/debian/dgwtimeserver.service b/debian/dgwtimeserver.service new file mode 100644 index 0000000..5c00484 --- /dev/null +++ b/debian/dgwtimeserver.service @@ -0,0 +1,13 @@ +[Unit] +Description=D-STAR Gateway Daemon +After=network.target,network-online.target +Wants=network-online.target + +[Service] +User=dstar +Type=simple +ExecStart=/usr/local/bin/dgwtimeserver %CFG_DIR%/dstargateway.cfg +Restart=on-failure + +[Install] +WantedBy=multi-user.target