From: Stephen Soltesz Date: Mon, 2 Nov 2009 22:36:41 +0000 (+0000) Subject: improve sendmail check to retry certain operations more than once. X-Git-Tag: PLCRT-1.0-11~2 X-Git-Url: http://git.onelab.eu/?p=plcrt.git;a=commitdiff_plain;h=1021061680a3379f70045f8be06becd1a2117449 improve sendmail check to retry certain operations more than once. --- diff --git a/plcrt.init b/plcrt.init index bd6db4c..e6db40d 100644 --- a/plcrt.init +++ b/plcrt.init @@ -222,28 +222,30 @@ check_rt_sendmail () # copy to live configuration cp -f $tmp_sendmailmc /etc/mail/sendmail.mc rm -f $tmp_sendmailmc + fi - # edit /etc/mail/access to add local IP - if ! grep "$PLC_RT_IP" /etc/mail/access ; then - echo "$PLC_RT_IP RELAY" >> /etc/mail/access - makemap hash /etc/mail/access.db < /etc/mail/access - fi - if [ ! -f /etc/smrsh/rt-mailgate ] ; then - ln -s /usr/sbin/rt-mailgate /etc/smrsh/rt-mailgate - fi - if ! grep "$PLC_RT_HOST" /etc/mail/local-host-names ; then - # edit /etc/mail/local-host-names - echo "$PLC_RT_HOST" >> /etc/mail/local-host-names - IP=$( gethostbyname $PLC_RT_HOST ) - REVHOST=$( gethostbyaddr $IP ) - if [ -n "$REVHOST" ] ; then - echo "$REVHOST" >> /etc/mail/local-host-names - fi - fi - m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf - service sendmail restart + # edit /etc/mail/access to add local IP + if ! grep "$PLC_RT_IP" /etc/mail/access ; then + echo "$PLC_RT_IP RELAY" >> /etc/mail/access + makemap hash /etc/mail/access.db < /etc/mail/access fi + if [ ! -f /etc/smrsh/rt-mailgate ] ; then + ln -s /usr/sbin/rt-mailgate /etc/smrsh/rt-mailgate + fi + + # TODO: fix this to only append the hostnaen once, rather than appending + if ! grep "$PLC_RT_HOST" /etc/mail/local-host-names ; then + # edit /etc/mail/local-host-names + echo "$PLC_RT_HOST" >> /etc/mail/local-host-names + IP=$( gethostbyname $PLC_RT_HOST ) + REVHOST=$( gethostbyaddr $IP ) + if [ -n "$REVHOST" ] ; then + echo "$REVHOST" >> /etc/mail/local-host-names + fi + fi + m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf + service sendmail restart }