diff --git a/DStarGateway/Makefile b/DStarGateway/Makefile index d5619c5..73318d1 100644 --- a/DStarGateway/Makefile +++ b/DStarGateway/Makefile @@ -21,7 +21,6 @@ install: dstargateway @cp -fn example.cfg $(CFG_DIR)/dstargateway.cfg @sed -i "s|path=/var/log/dstargateway/|path=$(LOG_DIR)|g" $(CFG_DIR)/dstargateway.cfg @sed -i "s|data=/usr/local/share/dstargateway.d/|data=$(DATA_DIR)|g" $(CFG_DIR)/dstargateway.cfg - @sed -i "s|daemon=false|daemon=true|g" $(CFG_DIR)/dstargateway.cfg ../APRS/APRS.a: ../Common/Common.a: diff --git a/DStarGateway/example.cfg b/DStarGateway/example.cfg index a6d71c7..36e38de 100644 --- a/DStarGateway/example.cfg +++ b/DStarGateway/example.cfg @@ -177,6 +177,9 @@ enabled=false port=4242 password=CHANGE_ME # If password is left blank, remote will be disabled regardless of the enabled field +# Provided install routines install the program as a systemd unit. SystemD does not recommand "old-school" forking daemons nor does systemd +# require a pid file. Moreover system handles the user under which the program is started. This is provided as convenience for people who might +# run the program using sysv or any other old school init system. [Daemon] daemon=false pidfile=/var/run/dstargateway/dstargateway.pid # pid file is in our case useless when running as a daemon using systemd as systemd takes care of the service not being started twice diff --git a/debian/dstargateway.service b/debian/dstargateway.service index 8b8185a..314a11d 100644 --- a/debian/dstargateway.service +++ b/debian/dstargateway.service @@ -1,10 +1,11 @@ [Unit] +User=dstar Description=D-STAR Gateway Daemon After=network.target,network-online.target Wants=network-online.target [Service] -Type=forking +Type=simple ExecStart=/usr/local/bin/dstargateway %CFG_DIR%/dstargateway.cfg Restart=on-failure RestartSec=5 @@ -13,5 +14,3 @@ StartLimitBurst=0 [Install] WantedBy=multi-user.target - -