logrotate on systems without invoke-rc.d
From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
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 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
@@ -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