Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
2 |
# |
3 |
# $FreeBSD: $ |
4 |
# |
5 |
# PROVIDE: qmailsend |
6 |
# REQUIRE: network |
7 |
# |
8 |
# The wrapper around qmail's qmail-send, qmail-lspawn, qmail-rspawn and |
9 |
# qmail-clean chain. |
10 |
# |
11 |
# the qmailsend_delivery variable controls where mails should be delivered to: |
12 |
# maildir - qmail-local to ~/Maildir/ (this is the default) |
13 |
# mailbox - qmail-local to ~/Mailbox |
14 |
# proc - procmail to /var/spool/mail/$USER |
15 |
# V7 - /bin/mail V7 interface to /var/spool/mail/$USER |
16 |
# SVR4 - /bin/mail SVR4 interface to /var/spool/mail/$USER |
17 |
# BSD44 - /usr/libexec/mail.local to /var/spool/mail/$USER |
18 |
# |
19 |
# Setting qmailsend_dotforward enables support for sendmail style |
20 |
# .forward files |
21 |
# |
22 |
|
23 |
. /etc/rc.subr |
24 |
|
25 |
name=qmailsend |
26 |
rcvar=qmailsend_enable |
27 |
|
28 |
load_rc_config $name |
29 |
|
30 |
: ${qmailsend_delivery="maildir"} |
31 |
: ${qmailsend_dotforward="NO"} |
32 |
|
33 |
start_cmd="${name}_start" |
34 |
command="%%PREFIX%%/bin/qmail-start" |
35 |
procname=qmail-send |
36 |
|
37 |
extra_commands="flush" |
38 |
flush_cmd="qmailsend_flush" |
39 |
|
40 |
pidfile="/var/run/${name}.pid" |
41 |
|
42 |
qmailsend_start() { |
43 |
case ${qmailsend_delivery} in |
44 |
maildir) command_args='./Maildir/';; |
45 |
mailbox) command_args='./Mailbox';; |
46 |
proc) command_args='|preline procmail';; |
47 |
V7) command_args='|preline -f /bin/mail -f "${SENDER:-MAILER-DAEMON}" -d "$USER"';; |
48 |
SVR4) command_args='|preline -f /bin/mail -r "${SENDER:-MAILER-DAEMON}" -d "$USER"';; |
49 |
BSD44) command_args='|preline -f /usr/libexec/mail.local -r "${SENDER:-MAILER-DAEMON}" -d "$USER"';; |
50 |
*) err 1 "Error: Unknown qmailsend delivery method: ${qmailsend_delivery}";; |
51 |
esac |
52 |
if checkyesno qmailsend_dotforward; then |
53 |
command_args='|dot-forward .forward |
54 |
'"${command_args}" |
55 |
fi |
56 |
|
57 |
exec env - PATH="%%PREFIX%%/bin:$PATH" ${command} \'"${command_args}"\' splogger qmail& |
58 |
/bin/pgrep -P $$ > ${pidfile} |
59 |
} |
60 |
|
61 |
qmailsend_flush() { |
62 |
/bin/pkill -ALRM ${rc_pid} |
63 |
} |
64 |
|
65 |
run_rc_command "$1" |
66 |
|