[oe-commits] Chong.Lu at windriver.com : collectd: add systemd unit file

git at git.openembedded.org git at git.openembedded.org
Tue Sep 23 17:01:29 UTC 2014


Module: meta-openembedded.git
Branch: master-next
Commit: d5ac28cb33f0d6b26227a88a727fa79ea58041d1
URL:    http://git.openembedded.org/?p=meta-openembedded.git&a=commit;h=d5ac28cb33f0d6b26227a88a727fa79ea58041d1

Author: Chong.Lu at windriver.com <Chong.Lu at windriver.com>
Date:   Thu Sep 18 09:23:59 2014 +0800

collectd: add systemd unit file

Add systemd unit file for collectd.

Signed-off-by: Chong Lu <Chong.Lu at windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>

---

 meta-oe/recipes-extended/collectd/collectd/collectd.service | 12 ++++++++++++
 meta-oe/recipes-extended/collectd/collectd_5.4.1.bb         | 13 +++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd.service b/meta-oe/recipes-extended/collectd/collectd/collectd.service
new file mode 100644
index 0000000..d835b73
--- /dev/null
+++ b/meta-oe/recipes-extended/collectd/collectd/collectd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Collectd
+After=local-fs.target network.target
+Requires=local-fs.target network.target
+
+[Service]
+ExecStart=@SBINDIR@/collectd -C /etc/collectd.conf -f
+Restart=always
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb b/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb
index dc5f88f..46752c8 100644
--- a/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb
+++ b/meta-oe/recipes-extended/collectd/collectd_5.4.1.bb
@@ -9,11 +9,14 @@ SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \
            file://no-gcrypt-badpath.patch \
            file://collectd-version.patch \
            file://glibc-2.20-compatiblity.patch \
-           file://collectd.init"
+           file://collectd.init \
+           file://collectd.service"
 SRC_URI[md5sum] = "6f56c71c96573a7f4f7fb3bfab185974"
 SRC_URI[sha256sum] = "75452129f271cb0aad28e57f12a49070618bbb7b6a9d64cf869e8766fa2f66e0"
 
-inherit autotools pythonnative update-rc.d pkgconfig
+inherit autotools pythonnative update-rc.d pkgconfig systemd
+
+SYSTEMD_SERVICE_${PN} = "collectd.service"
 
 # Floatingpoint layout, architecture dependent
 # 'nothing', 'endianflip' or 'intswap'
@@ -55,6 +58,12 @@ do_install_append() {
 
     rmdir "${D}${localstatedir}/run"
     rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
+
+    # Install systemd unit files
+    install -d ${D}${systemd_unitdir}/system
+    install -m 0644 ${WORKDIR}/collectd.service ${D}${systemd_unitdir}/system
+    sed -i -e 's, at SBINDIR@,${sbindir},g' \
+        ${D}${systemd_unitdir}/system/collectd.service
 }
 
 INITSCRIPT_NAME = "collectd"



More information about the Openembedded-commits mailing list