sendmail revision 124622
178344Sobrien#!/bin/sh 278344Sobrien# 398184Sgordon# $NetBSD: sendmail,v 1.14 2002/02/12 01:26:36 lukem Exp $ 498184Sgordon# $FreeBSD: head/etc/rc.d/sendmail 124622 2004-01-17 10:59:43Z mtm $ 578344Sobrien# 678344Sobrien 778344Sobrien# PROVIDE: mail 878344Sobrien# REQUIRE: LOGIN 9124616Smtm# KEYWORD: FreeBSD 1098184Sgordon# we make mail start late, so that things like .forward's are not 1198184Sgordon# processed until the system is fully operational 1278344Sobrien 1398184Sgordon# XXX - Get together with sendmail mantainer to figure out how to 1498184Sgordon# better handle SENDMAIL_ENABLE and 3rd party MTAs. 1598184Sgordon# 1678344Sobrien. /etc/rc.subr 1778344Sobrien 1878344Sobrienname="sendmail" 1998184Sgordonrcvar=`set_rcvar` 2078344Sobrienrequired_files="/etc/mail/${name}.cf" 21124622Smtmcommand=${sendmail_program:-/usr/sbin/sendmail} 22124622Smtmpidfile=${sendmail_pidfile:-/var/run/sendmail.pid} 2378344Sobrien 24124622Smtmload_rc_config $name 25102864Sgordon 26124622Smtmcase ${sendmail_enable} in 27124622Smtm[Nn][Oo][Nn][Ee]) 28124622Smtm sendmail_enable="NO" 29124622Smtm sendmail_submit_enable="NO" 30124622Smtm sendmail_outbound_enable="NO" 31124622Smtm sendmail_msp_queue_enable="NO" 32102864Sgordon ;; 33102864Sgordonesac 34102864Sgordon 3578344Sobriensendmail_precmd() 3678344Sobrien{ 3778344Sobrien # Die if there's pre-8.10 custom configuration file. This check is 3878344Sobrien # mandatory for smooth upgrade. See NetBSD PR 10100 for details. 3978344Sobrien # 4098184Sgordon if checkyesno ${rcvar} && [ -f "/etc/${name}.cf" ]; then 4178344Sobrien if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then 4278344Sobrien warn \ 4378344Sobrien "${name} was not started; you have multiple copies of sendmail.cf." 4478344Sobrien return 1 4578344Sobrien fi 4678344Sobrien fi 4778344Sobrien 4878344Sobrien # check modifications on /etc/mail/aliases 4978344Sobrien if [ -f "/etc/mail/aliases.db" ]; then 5078344Sobrien if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then 5178344Sobrien echo \ 5278344Sobrien "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating" 5378344Sobrien /usr/bin/newaliases 5478344Sobrien fi 5578344Sobrien else 5678344Sobrien echo \ 5778344Sobrien "${name}: /etc/mail/aliases.db not present, generating" 5878344Sobrien /usr/bin/newaliases 5978344Sobrien fi 6078344Sobrien 6178344Sobrien # check couple of common db files, too 6278344Sobrien for f in genericstable virtusertable domaintable mailertable; do 6398184Sgordon if [ -r "/etc/mail/$f" -a \ 6498184Sgordon "/etc/mail/$f" -nt "/etc/mail/$f.db" ]; then 6578344Sobrien echo \ 6678344Sobrien "${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating" 6778344Sobrien /usr/sbin/makemap hash /etc/mail/$f < /etc/mail/$f 6878344Sobrien fi 6978344Sobrien done 7078344Sobrien} 7178344Sobrien 7278344Sobrienrun_rc_command "$1" 7398184Sgordon 74124622Smtmrequired_files= 75104980Sschweikh 76124622Smtmif ! checkyesno sendmail_enable; then 77124622Smtm name="sendmail_submit" 78124622Smtm rcvar=`set_rcvar` 79124622Smtm start_cmd="${command} ${sendmail_submit_flags}" 80124622Smtm run_rc_command "$1" 81124622Smtmfi 8298184Sgordon 83124622Smtmif ! checkyesno sendmail_outbound_enable; then 84124622Smtm name="sendmail_outbound" 85124622Smtm rcvar=`set_rcvar` 86124622Smtm start_cmd="${command} ${sendmail_outbound_flags}" 87124622Smtm run_rc_command "$1" 88124622Smtmfi 8998184Sgordon 90124622Smtmname="sendmail_clientmqueue" 91124622Smtmrcvar="sendmail_msp_queue_enable" 92124622Smtmstart_cmd="${command} ${sendmail_msp_queue_flags}" 93124622Smtmpidfile="${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}" 94124622Smtmrequired_files="/etc/mail/submit.cf" 95124622Smtmrun_rc_command "$1" 96