]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
logrotate on systems without invoke-rc.d
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Mon, 26 Nov 2012 21:13:46 +0000 (13:13 -0800)
committerSage Weil <sage@inktank.com>
Mon, 26 Nov 2012 23:04:08 +0000 (15:04 -0800)
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 <oliva@lsd.ic.unicamp.br>
src/logrotate.conf

index aef3572918bf6b881992c2fd40668cab365130b2..97d4fcdc5456610a651b14933fde21d1b574f893 100644 (file)
@@ -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