blob: 6b0be89ac75dcdb0cfecb859303d0e50e11d3f9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: qmailsend.sh,v 1.3 2004/08/23 03:47:48 schmonz Exp $
#
# @PKGNAME@ script to control qmail-send (local and outgoing mail).
#
# PROVIDE: qmailsend mail
# REQUIRE: LOGIN
# KEYWORD: shutdown
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="qmailsend"
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
command="@LOCALBASE@/bin/qmail-send"
start_precmd="qmailsend_precmd"
extra_commands="stat pause cont doqueue reload queue alrm flush hup"
stat_cmd="qmailsend_stat"
pause_cmd="qmailsend_pause"
cont_cmd="qmailsend_cont"
doqueue_cmd="qmailsend_doqueue"
queue_cmd="qmailsend_queue"
alrm_cmd="qmailsend_doqueue"
flush_cmd="qmailsend_doqueue"
hup_cmd="qmailsend_hup"
# User-settable rc.conf variables and their default values:
qmailsend_postenv=${qmailsend_postenv-"PATH=@LOCALBASE@/bin:$PATH"}
qmailsend_defaultdelivery=${qmailsend_defaultdelivery-"`@HEAD@ -1 @PKG_SYSCONFDIR@/control/defaultdelivery`"}
qmailsend_logcmd=${qmailsend_logcmd-"@LOCALBASE@/bin/splogger nb${name}"}
qmailsend_precmd()
{
# qmail-start(8) starts the various qmail processes, then exits.
# qmail-send(8) is the process we want to signal later.
command="@SETENV@ - ${qmailsend_postenv} qmail-start '$qmailsend_defaultdelivery' ${qmailsend_logcmd}"
command_args="&"
rc_flags=""
}
qmailsend_stat()
{
run_rc_command status
}
qmailsend_pause()
{
if ! statusmsg=`run_rc_command status`; then
@ECHO@ $statusmsg
return 1
fi
@ECHO@ "Pausing ${name}."
kill -STOP $rc_pid
}
qmailsend_cont()
{
if ! statusmsg=`run_rc_command status`; then
@ECHO@ $statusmsg
return 1
fi
@ECHO@ "Continuing ${name}."
kill -CONT $rc_pid
}
qmailsend_doqueue()
{
if ! statusmsg=`run_rc_command status`; then
@ECHO@ $statusmsg
return 1
fi
@ECHO@ "Flushing timeout table and sending ALRM signal to qmail-send."
@LOCALBASE@/bin/qmail-tcpok
kill -ALRM $rc_pid
}
qmailsend_queue()
{
@LOCALBASE@/bin/qmail-qstat
@LOCALBASE@/bin/qmail-qread
}
qmailsend_hup()
{
run_rc_command reload
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
qmailsend_precmd
eval ${command} ${qmailsend_flags} ${command_args}
fi
|