monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PID file format problem


From: Werner Flamme
Subject: PID file format problem
Date: Fri, 24 Apr 2015 19:53:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi everyone,

I try to monitor my postfix master process by
---snip---
check process postfix with pidfile /var/spool/postfix/pid/master.pid
   group mail
   start program = "/usr/bin/systemctl start postfix.service"
   stop  program = "/usr/bin/systemctl stop postfix.service"
   if failed port 25 protocol smtp then restart
---pins---
the pid file exists, but is 32 bytes long and contains
---pins---
                           18992
---pins---
27 leading blanks and then the pid. I do not know who had the idea to
prepend these blanks, however, my postfix (2.11.5) creates it like that
and my monit (5.10) can't cope with it. It restarts postfix every
second, thus increasing the log files enormously.

Since postfix is started by systemd instead of a shell script, I can't
modify the startup script to use awk to replace the file's content.

Is there any possibility to have monit read a misformed pid file like
this? I can only guess to create a start/stop script containing s.th. like

#!/bin/bash
/usr/bin/systemctl start postfix.service
PIDF=/var/spool/postfix/pid/master.pid
/usr/bin/cp "$PIDF" "${PIDF}.bad"
/usr/bin/gawk '{ print $1; }' "$PIDF.bad" > "$PIDF"
/usr/bin/rm "${PIDF}.bad"

Regards,
Werner
-- 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]