Home | History | Annotate | Line # | Download | only in rc.d
postfix revision 1.10
      1   1.1   thorpej #!/bin/sh
      2   1.1   thorpej #
      3  1.10  christos # $NetBSD: postfix,v 1.10 2006/06/18 14:05:34 christos Exp $
      4   1.1   thorpej #
      5   1.1   thorpej 
      6   1.1   thorpej # PROVIDE: mail
      7   1.1   thorpej # REQUIRE: LOGIN
      8   1.6     lukem #	we make mail start late, so that things like .forward's are not
      9   1.6     lukem #	processed until the system is fully operational
     10   1.1   thorpej 
     11   1.9   mycroft $_rc_subr_loaded . /etc/rc.subr
     12   1.1   thorpej 
     13   1.3     lukem name="postfix"
     14   1.5     lukem rcvar=$name
     15   1.8     lukem postfix_command="/usr/sbin/${name}"
     16   1.3     lukem required_files="/etc/${name}/main.cf"
     17   1.6     lukem start_precmd="postfix_precmd"
     18   1.8     lukem start_cmd="postfix_op"
     19   1.8     lukem stop_cmd="postfix_op"
     20   1.8     lukem reload_cmd="postfix_op"
     21   1.5     lukem extra_commands="reload"
     22   1.6     lukem spooletcdir="/var/spool/${name}/etc"
     23   1.6     lukem required_dirs=$spooletcdir
     24   1.6     lukem 
     25   1.6     lukem postfix_precmd()
     26   1.6     lukem {
     27   1.6     lukem 	# As this is called after the is_running and required_dir checks
     28   1.6     lukem 	# are made in run_rc_command(), we can safely assume ${spooletcdir}
     29   1.6     lukem 	# exists and postfix isn't running at this point (unless forcestart
     30   1.6     lukem 	# is used).
     31   1.6     lukem 	#
     32   1.6     lukem 
     33   1.6     lukem 	for f in localtime resolv.conf services; do
     34   1.6     lukem 		if [ -f /etc/$f ]; then
     35   1.6     lukem 			cmp -s /etc/$f ${spooletcdir}/$f || \
     36   1.6     lukem 			    cp -p /etc/$f ${spooletcdir}/$f
     37   1.6     lukem 		fi
     38   1.6     lukem 	done
     39  1.10  christos 
     40  1.10  christos 	# check modifications on /etc/mail/aliases
     41  1.10  christos 	if [ -f "/etc/mail/aliases.db" ]; then
     42  1.10  christos 		if [ ! "/etc/mail/aliases" -ot "/etc/mail/aliases.db" ]; then
     43  1.10  christos 			echo \
     44  1.10  christos 	    "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
     45  1.10  christos 			/usr/bin/newaliases
     46  1.10  christos 		fi
     47  1.10  christos 	else
     48  1.10  christos 		echo \
     49  1.10  christos 	    "${name}: /etc/mail/aliases.db not present, generating"
     50  1.10  christos 			/usr/bin/newaliases
     51  1.10  christos 	fi
     52   1.6     lukem }
     53   1.1   thorpej 
     54   1.8     lukem postfix_op()
     55   1.8     lukem {
     56   1.8     lukem 	${postfix_command} ${rc_arg}
     57   1.8     lukem }
     58   1.8     lukem 
     59   1.4     lukem load_rc_config $name
     60   1.3     lukem run_rc_command "$1"
     61