summaryrefslogtreecommitdiff
path: root/mail/qmail-run
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2017-08-04 06:35:28 +0000
committerschmonz <schmonz@pkgsrc.org>2017-08-04 06:35:28 +0000
commit37666722b3f2755c3633e6f4f1ca1ea35c06bca9 (patch)
tree3667fd1ca0a153b672b3f6489606d6f964186a34 /mail/qmail-run
parent93b0dc24a2a21a7085abeda6a403b48670becad3 (diff)
downloadpkgsrc-37666722b3f2755c3633e6f4f1ca1ea35c06bca9.tar.gz
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 (limited to 'mail/qmail-run')
-rw-r--r--mail/qmail-run/Makefile4
-rw-r--r--mail/qmail-run/files/qmailsend.sh22
2 files changed, 20 insertions, 6 deletions
diff --git a/mail/qmail-run/Makefile b/mail/qmail-run/Makefile
index 9288493542f..51a44c7e80b 100644
--- a/mail/qmail-run/Makefile
+++ b/mail/qmail-run/Makefile
@@ -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 --git a/mail/qmail-run/files/qmailsend.sh b/mail/qmail-run/files/qmailsend.sh
index ecf9f5cf779..d2e2a1bf56b 100644
--- a/mail/qmail-run/files/qmailsend.sh
+++ b/mail/qmail-run/files/qmailsend.sh
@@ -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 @@ rcvar=${name}
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 @@ alrm_cmd="qmailsend_doqueue"
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 @@ ${qmailsend_logcmd}"
rc_flags=""
}
+qmailsend_poststart()
+{
+ echo $! > ${pidfile}
+}
+
+qmailsend_poststop()
+{
+ rm -f ${pidfile}
+}
+
qmailsend_stat()
{
run_rc_command status
@@ -103,6 +116,7 @@ if [ -f /etc/rc.subr ]; then
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
- qmailsend_precmd
+ qmailsend_prestart
eval ${command} ${qmailsend_flags} ${command_args}
+ qmailsend_poststart
fi