From 145364bbd933da8c1f384bea41f1b5cf37e9e082 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 3 Aug 2015 14:41:28 -0400 Subject: [PATCH] logrotate: fix log rotation with systemd systemctl does not have a nice way to enumerate (active) units so we can reload them. On centos7, the is-active wildcard syntax does not appear to be supported. On fedora 22, it prints the state only but not which unit the state belongs to. Simply killall -1 instead. Signed-off-by: Sage Weil --- src/logrotate.conf | 5 ++--- src/rgw/logrotate.conf | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/logrotate.conf b/src/logrotate.conf index a2eb896daac1d..5888f20db987d 100644 --- a/src/logrotate.conf +++ b/src/logrotate.conf @@ -9,9 +9,8 @@ elif which invoke-rc.d > /dev/null 2>&1 && [ -x `which invoke-rc.d` ]; then invoke-rc.d ceph reload >/dev/null elif which systemctl > /dev/null 2>&1 && [ -x `which systemctl` ]; then - if systemctl is-active 'ceph-*' | grep -i active > /dev/null 2>&1 ; then - systemctl reload 'ceph-*' >/dev/null || : - fi + # systemd does not provide an easy way to list (active) units + killall -q -1 ceph-mon ceph-mds ceph-osd fi # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then diff --git a/src/rgw/logrotate.conf b/src/rgw/logrotate.conf index 6cdfd13c251fb..f1dc58af33233 100644 --- a/src/rgw/logrotate.conf +++ b/src/rgw/logrotate.conf @@ -8,6 +8,9 @@ service ceph-radosgw reload >/dev/null elif which invoke-rc.d > /dev/null 2>&1 && [ -x `which invoke-rc.d` ]; then invoke-rc.d radosgw reload >/dev/null + elif which systemctl > /dev/null 2>&1 && [ -x `which systemctl` ]; then + # systemd does not provide an easy way to list (active) units + killall -q -1 radosgw fi # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then -- 2.47.3