postfix revision 1.11
1#!/bin/sh 2# 3# $NetBSD: postfix,v 1.11 2006/09/05 22:10:51 christos 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 24newaliases="/usr/bin/newaliases" 25 26postfix_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 for f in $(postconf -h alias_database); do 42 dbfile="${f#*:}" 43 if [ -f "${dbfile}.db" ]; then 44 if [ ! "${dbfile}" -ot "${dbfile}.db" ]; then 45 echo \ 46 "${name}: ${dbfile} newer than ${dbfile}.db, running $newaliases" 47 $newaliases 48 fi 49 else 50 echo \ 51 "${name}: ${dbfile}.db not present, running $newaliases" 52 $newaliases 53 fi 54 done 55} 56 57postfix_op() 58{ 59 ${postfix_command} ${rc_arg} 60} 61 62load_rc_config $name 63run_rc_command "$1" 64