Module: check_mk
Branch: master
Commit: 442e598afd9be8394e5db91ecc912775ee20254d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=442e598afd9be8…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon May 8 12:16:40 2017 +0200
Fixed Postfix process detection plus portability improvement.
* The path to the Postfix master contains an "sbin/" on Ubuntu.
* The 'if [[ ... ]]' syntax is a bash-ism (from 2.02 onwards), which we
should avoid in the agent. (Note that we should avoid the =~ operator in
it even more, it appeared in bash 3.0 only and had several bugs.)
Change-Id: I4cb920bdb3dddcf741714a4f22d26bdcf3a65047
---
agents/check_mk_agent.linux | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 5b2a580..7d1e3ea 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -691,7 +691,7 @@ if type postfix >/dev/null ; then
do
if [ -e "$i/pid/master.pid" ]; then
postfix_pid=$(cat $i/pid/master.pid | sed 's/ //g') # handle
possible spaces in output
- if [[ $(readlink -- /proc/$postfix_pid/exe) ==
*"postfix/master"* ]]; then
+ if readlink -- "/proc/$postfix_pid/exe" | grep -q
".*postfix/\(sbin/\)\?master.*"; then
echo "$i:the Postfix mail system is
running:PID:$postfix_pid" | sed 's/\/var\/spool\///g'
else
echo "$i:PID file exists but instance is not running!" |
sed 's/\/var\/spool\///g'