From 6d3de31791ca2078bd07ab1dfa7ede4eadc30b36f888e4202b36fe4da67c267d Mon Sep 17 00:00:00 2001 From: Christian Schneemann Date: Thu, 18 Oct 2012 11:21:46 +0000 Subject: [PATCH] Accepting request 131808 from home:elvigia:branches:server:monitoring - Add systemd rules. OBS-URL: https://build.opensuse.org/request/show/131808 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/collectd?expand=0&rev=111 --- collectd.changes | 5 +++++ collectd.service | 14 ++++++++++++++ collectd.spec | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 collectd.service diff --git a/collectd.changes b/collectd.changes index b4fc2e0..1d4fc2d 100644 --- a/collectd.changes +++ b/collectd.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Aug 27 21:39:32 UTC 2012 - crrodriguez@opensuse.org + +- Add systemd rules. + ------------------------------------------------------------------- Mon Jul 30 14:09:52 UTC 2012 - chris@computersalat.de diff --git a/collectd.service b/collectd.service new file mode 100644 index 0000000..86c519d --- /dev/null +++ b/collectd.service @@ -0,0 +1,14 @@ +[Unit] +Description=System statistics collection daemon +After=local-fs.target network.target +Requires=local-fs.target network.target + +[Service] +ExecStart=/usr/sbin/collectd -C /etc/collectd.conf -f +Restart=always +RestartSec=10 +StandardOutput=syslog +StandardError=syslog + +[Install] +WantedBy=multi-user.target diff --git a/collectd.spec b/collectd.spec index cea3ff9..ce99c50 100644 --- a/collectd.spec +++ b/collectd.spec @@ -131,6 +131,7 @@ Source10: http://devresources.linux-foundation.org/dev/iproute2/download/i # see https://bugzilla.novell.com/show_bug.cgi?id=388026 Source20: collectd-pthread.pc Source99: collectd-rpmlintrc +Source100: collectd.service Patch4: collectd-lib64.patch Patch7: collectd-fix-config.patch Patch9: collectd-version.patch @@ -262,6 +263,9 @@ BuildRequires: libxtables-devel %endif %if %suse_version >= 1210 %{perl_requires} +BuildRequires: systemd +%{?systemd_requires} +%define has_systemd 1 %endif # in case we'd like to split it later: Provides: collectd-perl = %{version}-%{release} @@ -789,16 +793,38 @@ cat<README.plugins-all This package is empty but depends on all collectd plugin subpackages. EOF +%if 0%{?has_systemd} +%__install -D -m0644 %{SOURCE100} %{buildroot}%{_unitdir}/collectd.service +%endif + %preun %stop_on_removal collectd +%if 0%{?has_systemd} +%service_del_preun %{name}.service +%endif + %postun %restart_on_update collectd %insserv_cleanup +%if 0%{?has_systemd} +%service_del_postun %{name}.service +%endif + +%pre + +%if 0%{?has_systemd} +%service_add_pre %{name}.service +%endif + %post %{fillup_only collectd} +%if 0%{?has_systemd} +%service_add_post %{name}.service +%endif + %post -n libcollectdclient0 -p /sbin/ldconfig %postun -n libcollectdclient0 -p /sbin/ldconfig @@ -844,6 +870,9 @@ EOF %dir %{_localstatedir}/lib/collectd /etc/init.d/collectd /usr/sbin/rccollectd +%if 0%{?has_systemd} +%{_unitdir}/collectd.service +%endif %files web %defattr(-,root,root)