From: Sage Weil Date: Mon, 3 Aug 2015 18:41:28 +0000 (-0400) Subject: logrotate: fix log rotation with systemd X-Git-Tag: v9.1.0~439^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=145364bbd933da8c1f384bea41f1b5cf37e9e082;p=ceph.git 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 --- diff --git a/src/logrotate.conf b/src/logrotate.conf index a2eb896daac1..5888f20db987 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 6cdfd13c251f..f1dc58af3323 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