postfix revision 1.9
1#!/bin/sh
2#
3# $NetBSD: postfix,v 1.9 2004/08/13 18:08:03 mycroft Exp $
4#
5
6# PROVIDE: mail
7# REQUIRE: LOGIN
8#	we make mail start late, so that things like .forward's are not
9#	processed until the system is fully operational
10
11$_rc_subr_loaded . /etc/rc.subr
12
13name="postfix"
14rcvar=$name
15postfix_command="/usr/sbin/${name}"
16required_files="/etc/${name}/main.cf"
17start_precmd="postfix_precmd"
18start_cmd="postfix_op"
19stop_cmd="postfix_op"
20reload_cmd="postfix_op"
21extra_commands="reload"
22spooletcdir="/var/spool/${name}/etc"
23required_dirs=$spooletcdir
24
25postfix_precmd()
26{
27	# As this is called after the is_running and required_dir checks
28	# are made in run_rc_command(), we can safely assume ${spooletcdir}
29	# exists and postfix isn't running at this point (unless forcestart
30	# is used).
31	#
32
33	for f in localtime resolv.conf services; do
34		if [ -f /etc/$f ]; then
35			cmp -s /etc/$f ${spooletcdir}/$f || \
36			    cp -p /etc/$f ${spooletcdir}/$f
37		fi
38	done
39}
40
41postfix_op()
42{
43	${postfix_command} ${rc_arg}
44}
45
46load_rc_config $name
47run_rc_command "$1"
48