Adjust systemd unit
authorCyril Brulebois <cyril@debamax.com>
Fri, 22 Jan 2021 13:25:54 +0000 (13:25 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 8 May 2021 13:10:12 +0000 (14:10 +0100)
 - Drop PIDFile (that uses an obsolete path, and doesn't seem to be
   used at all).
 - Adjust paths for the packaged crowdsec binary (/usr/bin).
 - Drop commented out ExecStartPost entirely.
 - Drop syslog.target dependency, it's socket-activated (thanks to the
   systemd-service-file-refers-to-obsolete-target lintian tag).
 - Ensure both local and online API credentials have been defined.

Gbp-Pq: Name 0003-adjust-systemd-unit.patch

config/crowdsec.service

index 4afa74d8cf1d8e5965fab35a0de23136936d74f7..c9d7150742698393df5820f69afc737e8d7ee881 100644 (file)
@@ -1,14 +1,15 @@
 [Unit]
 Description=Crowdsec agent
-After=syslog.target network.target remote-fs.target nss-lookup.target
+After=network.target remote-fs.target nss-lookup.target
+# Ensure configuration happened:
+ConditionPathExists=/etc/crowdsec/local_api_credentials.yaml
+ConditionPathExists=/etc/crowdsec/online_api_credentials.yaml
 
 [Service]
 Type=notify
 Environment=LC_ALL=C LANG=C
-PIDFile=/var/run/crowdsec.pid
-ExecStartPre=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml -t
-ExecStart=/usr/local/bin/crowdsec -c /etc/crowdsec/config.yaml
-#ExecStartPost=/bin/sleep 0.1
+ExecStartPre=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml -t
+ExecStart=/usr/bin/crowdsec -c /etc/crowdsec/config.yaml
 ExecReload=/bin/kill -HUP $MAINPID
 
 [Install]