Change to a script for event log rotation

This changes event log rotation to use a script.  The two main
reasons for this change are:
    1. systemd logs messages each time the service is started by
       the timer.
    2. If logrotate returns an error for any reason, the whole
       service is marked as failed.

This changes to a single long-running script to:
    1. Reduce the log messages for rotation.
    2. Print errors instead of failing the service.

Tested:
Filled the IPMI and Redfish logs and confirmed that they are still
correctly rotated.

Change-Id: I154ebf6c555aac3cfa57f143479e41d7c5482ffe
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service b/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service
index fdeefd4..8f3a2bc 100644
--- a/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service
+++ b/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.service
@@ -1,9 +1,9 @@
 [Unit]
-Description=Rotates the event logs
+Description=Rotate the event logs
 
 [Service]
-Type=oneshot
-ExecStart=/usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog
+Type=simple
+ExecStart=/usr/bin/rotate-event-logs.sh
 
 [Install]
 WantedBy=multi-user.target
diff --git a/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh b/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh
new file mode 100644
index 0000000..5a8c5cc
--- /dev/null
+++ b/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+while true; do
+    sleep 60
+    /usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog
+    ec=$?
+    if [ $ec -ne 0 ] ; then
+        echo "logrotate failed ($ec)"
+    fi
+done
diff --git a/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer b/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer
deleted file mode 100644
index ae1185e..0000000
--- a/meta-common/recipes-extended/rsyslog/rsyslog/rotate-event-logs.timer
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Run rotate-event-logs.service every minute
-
-[Timer]
-OnActiveSec=60
-OnUnitActiveSec=60
-
-[Install]
-WantedBy=timers.target
diff --git a/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend b/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend
index 7e28280..c426937 100644
--- a/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend
+++ b/meta-common/recipes-extended/rsyslog/rsyslog_%.bbappend
@@ -3,7 +3,7 @@
 SRC_URI += "file://rsyslog.conf \
            file://rsyslog.logrotate \
            file://rotate-event-logs.service \
-           file://rotate-event-logs.timer \
+           file://rotate-event-logs.sh \
            file://rsyslog-override.conf \
 "
 
@@ -13,11 +13,12 @@
 
 do_install_append() {
         install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir}
-        install -m 0644 ${WORKDIR}/rotate-event-logs.timer ${D}${systemd_system_unitdir}
         install -d ${D}${systemd_system_unitdir}/rsyslog.service.d
         install -m 0644 ${WORKDIR}/rsyslog-override.conf \
                         ${D}${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf
+        install -d ${D}${bindir}
+        install -m 0755 ${WORKDIR}/rotate-event-logs.sh ${D}/${bindir}/rotate-event-logs.sh
         rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
 }
 
-SYSTEMD_SERVICE_${PN} += " rotate-event-logs.service rotate-event-logs.timer"
+SYSTEMD_SERVICE_${PN} += " rotate-event-logs.service"