postfix revision 1.11
11.1Sthorpej#!/bin/sh 21.1Sthorpej# 31.11Schristos# $NetBSD: postfix,v 1.11 2006/09/05 22:10:51 christos Exp $ 41.1Sthorpej# 51.1Sthorpej 61.1Sthorpej# PROVIDE: mail 71.1Sthorpej# REQUIRE: LOGIN 81.6Slukem# we make mail start late, so that things like .forward's are not 91.6Slukem# processed until the system is fully operational 101.1Sthorpej 111.9Smycroft$_rc_subr_loaded . /etc/rc.subr 121.1Sthorpej 131.3Slukemname="postfix" 141.5Slukemrcvar=$name 151.8Slukempostfix_command="/usr/sbin/${name}" 161.3Slukemrequired_files="/etc/${name}/main.cf" 171.6Slukemstart_precmd="postfix_precmd" 181.8Slukemstart_cmd="postfix_op" 191.8Slukemstop_cmd="postfix_op" 201.8Slukemreload_cmd="postfix_op" 211.5Slukemextra_commands="reload" 221.6Slukemspooletcdir="/var/spool/${name}/etc" 231.6Slukemrequired_dirs=$spooletcdir 241.11Schristosnewaliases="/usr/bin/newaliases" 251.6Slukem 261.6Slukempostfix_precmd() 271.6Slukem{ 281.6Slukem # As this is called after the is_running and required_dir checks 291.6Slukem # are made in run_rc_command(), we can safely assume ${spooletcdir} 301.6Slukem # exists and postfix isn't running at this point (unless forcestart 311.6Slukem # is used). 321.6Slukem # 331.6Slukem 341.6Slukem for f in localtime resolv.conf services; do 351.6Slukem if [ -f /etc/$f ]; then 361.6Slukem cmp -s /etc/$f ${spooletcdir}/$f || \ 371.6Slukem cp -p /etc/$f ${spooletcdir}/$f 381.6Slukem fi 391.6Slukem done 401.10Schristos 411.11Schristos for f in $(postconf -h alias_database); do 421.11Schristos dbfile="${f#*:}" 431.11Schristos if [ -f "${dbfile}.db" ]; then 441.11Schristos if [ ! "${dbfile}" -ot "${dbfile}.db" ]; then 451.11Schristos echo \ 461.11Schristos "${name}: ${dbfile} newer than ${dbfile}.db, running $newaliases" 471.11Schristos $newaliases 481.11Schristos fi 491.11Schristos else 501.10Schristos echo \ 511.11Schristos "${name}: ${dbfile}.db not present, running $newaliases" 521.11Schristos $newaliases 531.10Schristos fi 541.11Schristos done 551.6Slukem} 561.1Sthorpej 571.8Slukempostfix_op() 581.8Slukem{ 591.8Slukem ${postfix_command} ${rc_arg} 601.8Slukem} 611.8Slukem 621.4Slukemload_rc_config $name 631.3Slukemrun_rc_command "$1" 64