pcp/0007-pmie-add-systemd-timers-as-cron-alternative.patch
David Disseldorp 0ce8d1aab1 Accepting request 666263 from home:dmdiss:bsc1121920_add_missing_pmda_bins
- Package missing PMDA binaries; (bsc#1121920).
  + refresh 0001-Install-libraries-without-exec-permission.patch
- Don't package pmns .NeedRebuild flag; (bsc#1092160).
  + add 0010-pmns-don-t-package-.NeedRebuild-for-SUSE-distros.patch

- Upgrade to 4.3.0; (bsc#1121914).
- Refreshed patches
  0001-Install-libraries-without-exec-permission.patch
  0007-pmie-add-systemd-timers-as-cron-alternative.patch
  0008-pmlogger_daily-add-systemd-timers-as-cron-alternativ.patch
  0009-pmlogger_daily_report-add-systemd-timers-as-cron-alt.patch

OBS-URL: https://build.opensuse.org/request/show/666263
OBS-URL: https://build.opensuse.org/package/show/Base:System/pcp?expand=0&rev=68
2019-01-15 15:05:04 +00:00

138 lines
4.3 KiB
Diff

From 7264f3bee5f1c9bf2fc666ca2a862c25b1173992 Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Mon, 7 Jan 2019 01:27:54 +0100
Subject: [PATCH] pmie: add systemd timers as cron alternative
The pmie_check and pmie_daily check timer/service files are
installed by default with ENABLE_SYSTEMD. crontab.docker is kept as-is.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
src/pmie/GNUmakefile | 22 ++++++++++++++++++++--
src/pmie/pmie_check.service.in | 8 ++++++++
src/pmie/pmie_check.timer | 10 ++++++++++
src/pmie/pmie_daily.service.in | 8 ++++++++
src/pmie/pmie_daily.timer | 8 ++++++++
5 files changed, 54 insertions(+), 2 deletions(-)
create mode 100644 src/pmie/pmie_check.service.in
create mode 100644 src/pmie/pmie_check.timer
create mode 100644 src/pmie/pmie_daily.service.in
create mode 100644 src/pmie/pmie_daily.timer
Index: pcp/src/pmie/GNUmakefile
===================================================================
--- pcp.orig/src/pmie/GNUmakefile
+++ pcp/src/pmie/GNUmakefile
@@ -18,7 +18,7 @@ include $(TOPDIR)/src/include/builddefs
SUBDIRS = src examples
OTHERS = control stomp rc_pmie pmie2col.sh pmie_check.sh pmie_daily.sh
-LDIRT = crontab crontab.docker pmie.service
+LDIRT = crontab crontab.docker pmie.service pmie_daily.service pmie_check.service
ifeq ($(TARGET_OS),linux)
CRONTAB_USER = $(PCP_USER)
@@ -28,7 +28,7 @@ CRONTAB_USER =
CRONTAB_PATH = $(PCP_SYSCONF_DIR)/pmie/crontab
endif
-default:: crontab crontab.docker pmie.service
+default:: crontab crontab.docker pmie.service pmie_daily.service pmie_check.service
default:: $(SUBDIRS)
$(SUBDIRS_MAKERULE)
@@ -50,6 +50,10 @@ endif
$(INSTALL) -m 755 rc_pmie $(PCP_RC_DIR)/pmie
ifeq ($(ENABLE_SYSTEMD),true)
$(INSTALL) -m 644 pmie.service $(PCP_SYSTEMDUNIT_DIR)/pmie.service
+ $(INSTALL) -m 644 pmie_daily.timer $(PCP_SYSTEMDUNIT_DIR)/pmie_daily.timer
+ $(INSTALL) -m 644 pmie_daily.service $(PCP_SYSTEMDUNIT_DIR)/pmie_daily.service
+ $(INSTALL) -m 644 pmie_check.timer $(PCP_SYSTEMDUNIT_DIR)/pmie_check.timer
+ $(INSTALL) -m 644 pmie_check.service $(PCP_SYSTEMDUNIT_DIR)/pmie_check.service
endif
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_LOG_DIR)/pmie
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_TMP_DIR)/pmie
@@ -61,7 +65,9 @@ ifeq ($(TARGET_OS),linux)
$(INSTALL) -m 755 -d $(PCP_LOG_DIR)/pmie
$(INSTALL) -m 1777 -d $(PCP_TMP_DIR)/pmie
endif
+ifneq ($(ENABLE_SYSTEMD),true)
$(INSTALL) -m 644 crontab $(CRONTAB_PATH)
+endif
include $(BUILDRULES)
@@ -75,6 +81,18 @@ pmie.service : pmie.service.in
-e 's;@PCP_RUN_DIR@;'$(PCP_RUN_DIR)';' \
# END
+pmie_check.service : pmie_check.service.in
+ $(SED) <$< >$@ \
+ -e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
+ -e 's;@PCP_USER@;'$(PCP_USER)';' \
+ # END
+
+pmie_daily.service : pmie_daily.service.in
+ $(SED) <$< >$@ \
+ -e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
+ -e 's;@PCP_USER@;'$(PCP_USER)';' \
+ # END
+
crontab: crontab.in
$(SED) -e 's;@user@;'$(CRONTAB_USER)';' -e 's;@path@;'$(PCP_BINADM_DIR)';g' $< > $@
Index: pcp/src/pmie/pmie_check.service.in
===================================================================
--- /dev/null
+++ pcp/src/pmie/pmie_check.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Check PMIE instances are running
+Documentation=man:pmie(1)
+
+[Service]
+Type=oneshot
+ExecStart=@PCP_BINADM_DIR@/pmie_check -C
+User=@PCP_USER@
Index: pcp/src/pmie/pmie_check.timer
===================================================================
--- /dev/null
+++ pcp/src/pmie/pmie_check.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Half-hourly check of PMIE instances
+
+[Timer]
+OnCalendar=*-*-* *:28:00
+OnCalendar=*-*-* *:58:00
+
+[Install]
+WantedBy=timers.target
+
Index: pcp/src/pmie/pmie_daily.service.in
===================================================================
--- /dev/null
+++ pcp/src/pmie/pmie_daily.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Process PMIE logs
+Documentation=man:pmie(1)
+
+[Service]
+Type=oneshot
+ExecStart=@PCP_BINADM_DIR@/pmie_daily -X xz -x 3
+User=@PCP_USER@
Index: pcp/src/pmie/pmie_daily.timer
===================================================================
--- /dev/null
+++ pcp/src/pmie/pmie_daily.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=Daily processing of PMIE logs
+
+[Timer]
+OnCalendar=*-*-* 00:08:00
+
+[Install]
+WantedBy=timers.target