From d1186b3013be10adc4e6d3e53b25bd8dc12ee7fbeab3511646fb180e2b2d31ba Mon Sep 17 00:00:00 2001
From: Denisart Benjamin
Date: Sun, 9 Feb 2014 19:33:54 +0000
Subject: [PATCH] Accepting request 221484 from
home:jsjhb:branches:devel:languages:python
- again fix PIDfile handling for rrdcached in systemd file
(ugly now: because of removal of declaration in sysconfig file;
it has to be declared twice in service file)
- add PIDfile directory using tmpfiles now
OBS-URL: https://build.opensuse.org/request/show/221484
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/rrdtool?expand=0&rev=55
---
rrdcached-systemd-pre | 4 ----
rrdcached.service | 4 ++--
rrdtool.changes | 8 ++++++++
rrdtool.spec | 10 +++++++---
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/rrdcached-systemd-pre b/rrdcached-systemd-pre
index fbec76a..f7a56a5 100644
--- a/rrdcached-systemd-pre
+++ b/rrdcached-systemd-pre
@@ -14,8 +14,6 @@ test -r $RRDCACHED_CONFIG || { echo "$RRDCACHED_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
-RRDCACHED_PID='/run/rrdcached.pid'
-
# Read config
. $RRDCACHED_CONFIG
@@ -24,8 +22,6 @@ function check_and_create_dir(){
test -d "$DIR" || mkdir -p "$DIR"
}
-check_and_create_dir "$(dirname $RRDCACHED_PID)"
-chown $RRDCACHED_USER:$RRDCACHED_GROUP "$(dirname $RRDCACHED_PID)"
case "$RRDCACHED_ADDRESS" in
^unix:)
SOCKETDIR=$(dirname ${RRDCACHED_ADDRESS/unix:/})
diff --git a/rrdcached.service b/rrdcached.service
index 02a3eba..de26f55 100644
--- a/rrdcached.service
+++ b/rrdcached.service
@@ -16,10 +16,10 @@ Type=forking
ExecStartPre=-/bin/echo 'Starting RRD data caching service (rrdtools - rrdcached)'
ExecStartPre=/bin/sh -c "/usr/share/rrdcached/rrdcached-systemd-pre"
EnvironmentFile=-/etc/sysconfig/rrdcached
-ExecStart=/usr/bin/rrdcached -s $RRDCACHED_GROUP -b "$RRDCACHED_CHROOT_DIR" -p "$RRDCACHED_PID" -l $RRDCACHED_ADDRESS -m $RRDCACHED_SOCKET_MASK -w $RRDCACHED_DISKWRITE -z $RRDCACHED_DELAY -t $RRDCACHED_WRITE_THREADS $RRDCACHED_OPTIONS
+ExecStart=/usr/bin/rrdcached -s $RRDCACHED_GROUP -b "$RRDCACHED_CHROOT_DIR" -p /run/rrdcached/rrdcached.pid -l $RRDCACHED_ADDRESS -m $RRDCACHED_SOCKET_MASK -w $RRDCACHED_DISKWRITE -z $RRDCACHED_DELAY -t $RRDCACHED_WRITE_THREADS $RRDCACHED_OPTIONS
Restart=always
RestartSec=1
-PIDFile=/run/rrdcached.pid
+PIDFile=/run/rrdcached/rrdcached.pid
TimeoutStopSec=10
[Install]
diff --git a/rrdtool.changes b/rrdtool.changes
index 7a7ccf3..a90746c 100644
--- a/rrdtool.changes
+++ b/rrdtool.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Sun Feb 9 08:58:51 UTC 2014 - obs@botter.cc
+
+- again fix PIDfile handling for rrdcached in systemd file
+ (ugly now: because of removal of declaration in sysconfig file;
+ it has to be declared twice in service file)
+- add PIDfile directory using tmpfiles now
+
-------------------------------------------------------------------
Mon Jan 13 08:42:10 UTC 2014 - coolo@suse.com
diff --git a/rrdtool.spec b/rrdtool.spec
index 086b23c..4a97efb 100644
--- a/rrdtool.spec
+++ b/rrdtool.spec
@@ -16,6 +16,8 @@
#
+%{!?_tmpfilesdir:%global _tmpfilesdir /usr/lib/tmpfiles.d}
+
Name: rrdtool
BuildRequires: autoconf
BuildRequires: automake
@@ -243,7 +245,9 @@ install -Dm644 %{SOURCE2} %{buildroot}%{_localstatedir}/adm/fillup-templates/sys
# install systemd specific files
install -Dm755 %{SOURCE4} %{buildroot}%{_datadir}/rrdcached/rrdcached-systemd-pre
install -Dm644 %{SOURCE5} %{buildroot}%{_unitdir}/rrdcached.service
-mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached
+install -d -m 0755 %{buildroot}/%{_tmpfilesdir}
+echo "d /run/rrdcached 0755 %{rrdcached_user} %{rrdcached_group}" > %{buildroot}/%{_tmpfilesdir}/rrdcached.conf
+chmod 644 %{buildroot}/%{_tmpfilesdir}/rrdcached.conf
%post -p /sbin/ldconfig
@@ -296,11 +300,10 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/rrdtool/rrdcached
%defattr(-, root, root)
%{_bindir}/rrdcached
%{_localstatedir}/adm/fillup-templates/sysconfig.rrdcached
-%dir %{_localstatedir}/lib/rrdtool
-%attr(-,%rrdcached_user,%rrdcached_group) %dir %{_localstatedir}/lib/rrdtool/rrdcached
%{_datadir}/rrdcached
%{_datadir}/rrdcached/rrdcached-systemd-pre
%{_unitdir}/rrdcached.service
+%{_tmpfilesdir}/rrdcached.conf
%pre cached
getent group %rrdcached_group >/dev/null || groupadd %rrdcached_group
@@ -310,6 +313,7 @@ getent passwd %rrdcached_user >/dev/null || useradd -s /sbin/nologin -g %rrdcach
%post cached
%service_add_post rrdcached.service
%fillup_only rrdcached
+systemd-tmpfiles --create %{_tmpfilesdir}/rrdcached.conf
%preun cached
%service_del_preun rrdcached.service