On Sun, 16 Sep 2012 14:02:56 +0200 Martin Kos <debian....@koks.li> wrote:
> I am using nullmailer on a LXC virtualized host with the guests also > running nullmailer. Starting nullmailer on the > by /etc/init.d/nullmailer fails because the init-script makes a check > if there are other nullmailer instances running: PIDS=`pidof > nullmailer-send` and this obviously fails because the nullmailer > processes from the guest VMs are listed with the "pidof" function. I just ran into the same problem. I'm operating nullmailer within multiple chroots. I propose to reuse the pidofproc function from /lib/lsb/init-functions and rely onto the pid file instead of querying the process list. Also I propose to propagate the pid file to status_of_proc when determining the process status. Patch attached.
--- debian/init.old 2012-06-16 13:41:42.000000000 +0200 +++ debian/init 2013-04-06 19:22:51.625413742 +0200 @@ -25,9 +25,8 @@ case "$1" in start) log_begin_msg "Starting $DESC:" "$NAME" - PIDS=`pidof nullmailer-send` # don't kill trigger if daemon already running - if [ -z "$PIDS" ]; then + if ! pidofproc -p $PIDFILE $DAEMON; then if [ ! -p /var/spool/nullmailer/trigger ]; then rm -f /var/spool/nullmailer/trigger mkfifo /var/spool/nullmailer/trigger @@ -54,7 +53,7 @@ $0 start ;; status) - status_of_proc $DAEMON $NAME + status_of_proc -p $PIDFILE $DAEMON $NAME exit $? ;; *)
signature.asc
Description: PGP signature