pcp/0009-pmlogger_daily_report-add-systemd-timers-as-cron-alt.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

130 lines
5.1 KiB
Diff

From f026b0e562172e05fd2753caad2ae41e390cad90 Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Mon, 7 Jan 2019 13:24:52 +0100
Subject: [PATCH] pmlogger_daily_report: add systemd timers as cron alternative
The timer and service files are installed by default with
ENABLE_SYSTEMD.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
src/pmlogger/GNUmakefile | 23 +++++++++++++++++++++-
src/pmlogger/pmlogger_daily_report.service.in | 8 ++++++++
src/pmlogger/pmlogger_daily_report.timer | 8 ++++++++
src/pmlogger/pmlogger_daily_report_poll.service.in | 8 ++++++++
src/pmlogger/pmlogger_daily_report_poll.timer | 8 ++++++++
5 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 src/pmlogger/pmlogger_daily_report.service.in
create mode 100644 src/pmlogger/pmlogger_daily_report.timer
create mode 100644 src/pmlogger/pmlogger_daily_report_poll.service.in
create mode 100644 src/pmlogger/pmlogger_daily_report_poll.timer
Index: pcp/src/pmlogger/GNUmakefile
===================================================================
--- pcp.orig/src/pmlogger/GNUmakefile
+++ pcp/src/pmlogger/GNUmakefile
@@ -22,7 +22,8 @@ OTHERS = pmnewlog.sh control rc_pmlogger
pmlogger_daily_report.sh pmlogger_rewrite.sh
LDIRT = crontab crontab.docker crontab.daily_report pmlogger.service \
pmlogger_daily.service pmlogger_daily_poll.service \
- pmlogger_daily_check.service
+ pmlogger_daily_check.service pmlogger_daily_report.service \
+ pmlogger_daily_report_poll.service
ifeq ($(TARGET_OS),linux)
CRONTAB_USER = $(PCP_USER)
@@ -65,6 +66,10 @@ ifeq ($(ENABLE_SYSTEMD),true)
$(INSTALL) -m 644 pmlogger_daily_poll.service $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_poll.service
$(INSTALL) -m 644 pmlogger_daily_check.timer $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_check.timer
$(INSTALL) -m 644 pmlogger_daily_check.service $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_check.service
+ $(INSTALL) -m 644 pmlogger_daily_report.timer $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_report.timer
+ $(INSTALL) -m 644 pmlogger_daily_report.service $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_report.service
+ $(INSTALL) -m 644 pmlogger_daily_report_poll.timer $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_report_poll.timer
+ $(INSTALL) -m 644 pmlogger_daily_report_poll.service $(PCP_SYSTEMDUNIT_DIR)/pmlogger_daily_report_poll.service
endif
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_LOG_DIR)/pmlogger
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_TMP_DIR)/pmlogger
@@ -81,7 +86,9 @@ ifneq ($(ENABLE_SYSTEMD),true)
endif
$(INSTALL) -m 644 utilproc.sh $(PCP_SHARE_DIR)/lib/utilproc.sh
$(INSTALL) -m 755 pmlogger_daily_report.sh $(PCP_BINADM_DIR)/pmlogger_daily_report$(SHELLSUFFIX)
+ifneq ($(ENABLE_SYSTEMD),true)
$(INSTALL) -m 644 crontab.daily_report $(CRONTAB_DAILY_REPORT_PATH)
+endif
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_SA_DIR)
include $(BUILDRULES)
@@ -114,6 +121,20 @@ pmlogger_daily_check.service : pmlogger_
-e 's;@PCP_USER@;'$(PCP_USER)';' \
# END
+pmlogger_daily_report.service : pmlogger_daily_report.service.in
+ $(SED) <$< >$@ \
+ -e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
+ -e 's;@PCP_USER@;'$(PCP_USER)';' \
+ -e 's;@PCP_SA_DIR@;'$(PCP_SA_DIR)';' \
+ # END
+
+pmlogger_daily_report_poll.service : pmlogger_daily_report_poll.service.in
+ $(SED) <$< >$@ \
+ -e 's;@PCP_BINADM_DIR@;'$(PCP_BINADM_DIR)';' \
+ -e 's;@PCP_USER@;'$(PCP_USER)';' \
+ -e 's;@PCP_SA_DIR@;'$(PCP_SA_DIR)';' \
+ # END
+
crontab : crontab.in
$(SED) -e 's;@user@;'$(CRONTAB_USER)';' -e 's;@path@;'$(PCP_BINADM_DIR)';' $< > $@
Index: pcp/src/pmlogger/pmlogger_daily_report.service.in
===================================================================
--- /dev/null
+++ pcp/src/pmlogger/pmlogger_daily_report.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Generate system activity reports
+Documentation=man:pmlogger(1)
+
+[Service]
+Type=oneshot
+ExecStart=@PCP_BINADM_DIR@/pmlogger_daily_report -o @PCP_SA_DIR@
+User=@PCP_USER@
Index: pcp/src/pmlogger/pmlogger_daily_report.timer
===================================================================
--- /dev/null
+++ pcp/src/pmlogger/pmlogger_daily_report.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=Daily generation of system activity reports
+
+[Timer]
+OnCalendar=*-*-* 02:00:00
+
+[Install]
+WantedBy=timers.target
Index: pcp/src/pmlogger/pmlogger_daily_report_poll.service.in
===================================================================
--- /dev/null
+++ pcp/src/pmlogger/pmlogger_daily_report_poll.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=Poll system activity report generation
+Documentation=man:pmlogger(1)
+
+[Service]
+Type=oneshot
+ExecStart=@PCP_BINADM_DIR@/pmlogger_daily_report -o @PCP_SA_DIR@ -p
+User=@PCP_USER@
Index: pcp/src/pmlogger/pmlogger_daily_report_poll.timer
===================================================================
--- /dev/null
+++ pcp/src/pmlogger/pmlogger_daily_report_poll.timer
@@ -0,0 +1,8 @@
+[Unit]
+Description=Hourly polling of system activity report generation
+
+[Timer]
+OnCalendar=*-*-* *:30:00
+
+[Install]
+WantedBy=timers.target