pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mail/qmail-run If there's more than one qmail-send run...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c69cb6e10094
branches:  trunk
changeset: 366142:c69cb6e10094
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Fri Aug 04 06:35:28 2017 +0000

description:
If there's more than one qmail-send running (e.g., /var/qmail2 running
from /service), the rc.d script can't tell which is ours. Make and use
a pidfile.

(The other rc.d scripts set argv[0] to names that are unlikely to
collide, but there's no easy way to do that for the qmail-send process
exec'd by qmail-start.)

Bump PKGREVISION.

diffstat:

 mail/qmail-run/Makefile           |   4 ++--
 mail/qmail-run/files/qmailsend.sh |  22 ++++++++++++++++++----
 2 files changed, 20 insertions(+), 6 deletions(-)

diffs (71 lines):

diff -r a46eb2eeb9c9 -r c69cb6e10094 mail/qmail-run/Makefile
--- a/mail/qmail-run/Makefile   Fri Aug 04 05:33:40 2017 +0000
+++ b/mail/qmail-run/Makefile   Fri Aug 04 06:35:28 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.41 2017/07/30 03:05:58 schmonz Exp $
+# $NetBSD: Makefile,v 1.42 2017/08/04 06:35:28 schmonz Exp $
 #
 
-DISTNAME=              qmail-run-20170729
+DISTNAME=              qmail-run-20170804
 CATEGORIES=            mail
 MASTER_SITES=          # empty
 DISTFILES=             # empty
diff -r a46eb2eeb9c9 -r c69cb6e10094 mail/qmail-run/files/qmailsend.sh
--- a/mail/qmail-run/files/qmailsend.sh Fri Aug 04 05:33:40 2017 +0000
+++ b/mail/qmail-run/files/qmailsend.sh Fri Aug 04 06:35:28 2017 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: qmailsend.sh,v 1.10 2017/06/17 05:58:39 schmonz Exp $
+# $NetBSD: qmailsend.sh,v 1.11 2017/08/04 06:35:28 schmonz Exp $
 #
 # @PKGNAME@ script to control qmail-send (local and outgoing mail).
 #
@@ -26,7 +26,10 @@
 required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
 required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
 command="@PREFIX@/bin/qmail-send"
-start_precmd="qmailsend_precmd"
+start_precmd="qmailsend_prestart"
+start_postcmd="qmailsend_poststart"
+stop_postcmd="qmailsend_poststop"
+pidfile="@VARBASE@/run/${name}.pid"
 extra_commands="stat pause cont doqueue reload queue alrm flush hup"
 stat_cmd="qmailsend_stat"
 pause_cmd="qmailsend_pause"
@@ -37,7 +40,7 @@
 flush_cmd="qmailsend_doqueue"
 hup_cmd="qmailsend_hup"
 
-qmailsend_precmd()
+qmailsend_prestart()
 {
        # qmail-start(8) starts the various qmail processes, then exits.
        # qmail-send(8) is the process we want to signal later.
@@ -51,6 +54,16 @@
        rc_flags=""
 }
 
+qmailsend_poststart()
+{
+       echo $! > ${pidfile}
+}
+
+qmailsend_poststop()
+{
+       rm -f ${pidfile}
+}
+
 qmailsend_stat()
 {
        run_rc_command status
@@ -103,6 +116,7 @@
        run_rc_command "$1"
 else
        @ECHO_N@ " ${name}"
-       qmailsend_precmd
+       qmailsend_prestart
        eval ${command} ${qmailsend_flags} ${command_args}
+       qmailsend_poststart
 fi



Home | Main Index | Thread Index | Old Index