RIP PCVT userland.
[dragonfly.git] / etc / rc.d / postfix
1 #!/bin/sh
2 #
3 # $NetBSD: postfix,v 1.6 2002/02/12 02:19:27 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/postfix,v 1.2 2002/06/13 22:14:36 gordon Exp $
5 # $DragonFly: src/etc/rc.d/Attic/postfix,v 1.1 2003/07/24 06:35:37 dillon Exp $
6 #
7
8 # PROVIDE: mail
9 # REQUIRE: LOGIN
10 #       we make mail start late, so that things like .forward's are not
11 #       processed until the system is fully operational
12
13 . /etc/rc.subr
14
15 name="postfix"
16 rcvar=$name
17 required_files="/etc/${name}/main.cf"
18 start_precmd="postfix_precmd"
19 start_cmd="${name} start"
20 stop_cmd="${name} stop"
21 reload_cmd="${name} reload"
22 extra_commands="reload"
23 spooletcdir="/var/spool/${name}/etc"
24 required_dirs=$spooletcdir
25
26 postfix_precmd()
27 {
28         # As this is called after the is_running and required_dir checks
29         # are made in run_rc_command(), we can safely assume ${spooletcdir}
30         # exists and postfix isn't running at this point (unless forcestart
31         # is used).
32         #
33
34         for f in localtime resolv.conf services; do
35                 if [ -f /etc/$f ]; then
36                         cmp -s /etc/$f ${spooletcdir}/$f || \
37                             cp -p /etc/$f ${spooletcdir}/$f
38                 fi
39         done
40 }
41
42 load_rc_config $name
43 run_rc_command "$1"