collectd: Add service file
authorMaxime Hadjinlian <maxime.hadjinlian@gmail.com>
Sun, 21 Feb 2016 13:09:15 +0000 (14:09 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 21 Feb 2016 13:28:43 +0000 (14:28 +0100)
The service file was taken from Debian.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/collectd/collectd.mk
package/collectd/collectd.service [new file with mode: 0644]

index eb66f2563e5c871d6b65d9983f8f0d5f8c845297..78e24b8a0f45b3b2082f019b7561de0a6511e674 100644 (file)
@@ -185,4 +185,12 @@ define COLLECTD_INSTALL_TARGET_CMDS
        rm -f $(TARGET_DIR)/usr/share/collectd/postgresql_default.conf
 endef
 
+define COLLECTD_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/collectd/collectd.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/collectd.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -fs ../../../../usr/lib/systemd/system/collectd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/collectd.service
+endef
+
 $(eval $(autotools-package))
diff --git a/package/collectd/collectd.service b/package/collectd/collectd.service
new file mode 100644 (file)
index 0000000..e203806
--- /dev/null
@@ -0,0 +1,17 @@
+[Unit]
+Description=Statistics collection and monitoring daemon
+After=local-fs.target network.target
+Requires=local-fs.target network.target
+ConditionPathExists=/etc/collectd.conf
+
+[Service]
+Type=notify
+NotifyAccess=main
+EnvironmentFile=-/etc/default/collectd
+ExecStartPre=/usr/sbin/collectd -t
+ExecStart=/usr/sbin/collectd
+Restart=always
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target