On 8/19/2014 4:10 AM, Sascha Hüdepohl wrote: > Hi! > > I would lilke to automatically check if postfix is OK. > > So i run postfix check.
It sounds as if you're trying to monitor postfix health. Unfortunately "postfix check" isn't very useful for that, as it's designed to test for installation errors, not runtime problems. Once installation is completed, it should never return errors (until the next botched upgrade or file system corruption). Maybe "postfix status" is what you're looking for. You can either check the exit status (non-0 means not running), or look for PID: in the stderr output. > > Example: > > # chmod 555 /usr/sbin/postqueue > # postfix check > postfix/postfix-script: warning: not set-gid or not owner+group+world > executable: /usr/sbin/postqueue run "postfix set-permissions" to fix this installation error. -- Noel Jones > > > Because postfix check doesn't set the exit-code i thought to use grep -q > > # postfix check | grep warning > > Ok, postifx check writes to stderr: > > # postfix check 2>&1 | grep warning > > But grep gets no input. > > > I can't figure out what i'm doing wrong. > > Is there a better way? > > > regards > Sascha >