From: Alexandre Oliva Date: Mon, 26 Nov 2012 21:13:46 +0000 (-0800) Subject: logrotate on systems without invoke-rc.d X-Git-Tag: v0.55~46 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b1c71088bbd13955cfa81283fa2efc34822cd873;p=ceph.git logrotate on systems without invoke-rc.d The which command doesn't output anything to stdout when it can't find the given program name, and then [ -x ] passes. Use the exit status of which to tell whether the command exists, before testing whether it's executable, to fix it. Signed-off-by: Alexandre Oliva --- diff --git a/src/logrotate.conf b/src/logrotate.conf index aef3572918bf..97d4fcdc5456 100644 --- a/src/logrotate.conf +++ b/src/logrotate.conf @@ -4,11 +4,11 @@ compress sharedscripts postrotate - if [ -x `which invoke-rc.d` ]; then + if which invoke-rc.d && [ -x `which invoke-rc.d` ]; then invoke-rc.d ceph reload >/dev/null - elif [ -x `which service` ]; then + elif which service && [ -x `which service` ]; then service ceph reload >/dev/null - elif [ -x `which initctl` ]; then + elif which initctl && [ -x `which initctl` ]; then # upstart reload isn't very helpful here: # https://bugs.launchpad.net/upstart/+bug/1012938 for type in mon osd mds; do