I'm searching for a reliable way to test if postfix is running from inside a bash script.My first attempt was simply trying pidof postfix, which doesn't work.Then I tried to get the postfix status:POSTFIX_LOCATION=/var/packages/MailServer/target/sbin/postfix # location of postfixresult=`$POSTFIX_LOCATION status`if [ -z $result ]; then    echo Error: No status output from postfixelif [[ $result == *is running* ]]; then    echo postfix is running!else echo postfix is not running!fiBut even though the status is reported to the console, the result variable stays empty.This is the console output:postfix/postfix-script: the Postfix mail system is running: PID: 11996Error: No status output from postfixI finally found a way to test if postfix is running by getting the process name of PID: 11996, which is master. So the following does work:pidof masterBut this is not very verbose and I'm not sure if this is a reliable way to test if postfix is running.So my questions are:How can I get the output of postfix status from inside a bash script? -Anything I'm doing wrong there? Is there a better reliable way to test if postfix is running from inside a bash script?
Test if postfix is running
linux;bash;postfix