I was getting email with logrotate error output from “which invoke-rc.d” on systems without an invoke-rc.d. This patch silences it.
Silence stderr from which when running logrotate From: Alexandre Oliva <oliva@xxxxxxx> Signed-off-by: Alexandre Oliva <oliva@xxxxxxx> --- src/logrotate.conf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/logrotate.conf b/src/logrotate.conf index 9af3104..c443eed 100644 --- a/src/logrotate.conf +++ b/src/logrotate.conf @@ -4,13 +4,16 @@ compress sharedscripts postrotate - if which invoke-rc.d > /dev/null && [ -x `which invoke-rc.d` ]; then + if which invoke-rc.d > /dev/null 2>&1 && + [ -x `which invoke-rc.d` ]; then invoke-rc.d ceph reload >/dev/null - elif which service > /dev/null && [ -x `which service` ]; then + elif which service > /dev/null 2>&1 && + [ -x `which service` ]; then service ceph reload >/dev/null fi # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op - if which initctl > /dev/null && [ -x `which initctl` ]; then + if which initctl > /dev/null 2>&1 && + [ -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
-- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer