blob: 7dc89bbff786e2a62ea65d35fcff6ae2d037eeac (
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
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: proxsmtpd.sh,v 1.1.1.1 2004/12/02 04:08:18 jlam Exp $
#
# PROVIDE: proxsmtpd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="proxsmtpd"
rcvar=$name
command="@PREFIX@/sbin/${name}"
start_precmd="proxsmtpd_prestart"
stop_postcmd="proxsmtpd_poststop"
user="nobody"
tempdir="/tmp"
pidfile=/var/run/${name}.pid
conffile="@PKG_SYSCONFDIR@/${name}.conf"
if [ -f "${conffile}" ]; then
user=`@AWK@ 'BEGIN {r = "nobody"}; /^User:/ {r = $2}; END {print r}' ${conffile}`
tempdir=`@AWK@ 'BEGIN {r = "/tmp"}; /^TempDirectory:/ {r = $2}; END {print r}' ${conffile}`
case ${tempdir} in
/tmp) ;;
*) pidfile="${tempdir}/${name}.pid" ;;
esac
fi
command_args="-p ${pidfile}"
proxsmtpd_prestart()
{
case ${tempdir} in
/tmp) ;;
*) if [ ! -d "${tempdir}" ]; then
@MKDIR@ -p ${tempdir}
fi
@CHOWN@ -R ${user} ${tempdir}
@CHMOD@ -R 0700 ${tempdir}
;;
esac
@TOUCH@ ${pidfile}
@CHOWN@ ${user} ${pidfile}
}
proxsmtpd_poststop()
{
@RM@ -f ${pidfile}
case ${tempdir} in
/tmp) ;;
*) @RMDIR@ -p ${tempdir} 2>/dev/null || @TRUE@
esac
}
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
load_rc_config $name
run_rc_command "$1"
else
if [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
@ECHO@ -n " ${name}"
eval ${start_precmd}
${command} ${proxsmtpd_flags} ${command_args}
fi
|