#!/bin/sh # # This script sets the mailforward for root in the file # /etc/mail/aliases. It also makes sure that the SMTP # smart host is setup properly. # # Harry Hoffman # ALIASES=${JASS_ROOT_DIR}/etc/mail/aliases SENDMAILCONF=${JASS_ROOT_DIR}/etc/mail/sendmail.cf logMessage "Forwarding root's mail to the itss unix mail admin list." if [ ! -f ${ALIASES} ]; then logNotice "The aliases file could not be found, I'm giving up now." elif [ `grep -c "^root:.*$" ${ALIASES}` -ne 0 ]; then backup_file ${ALIASES} logMessage "Forwarding root's mail via the entry in the file, ${ALIASES}." cat ${ALIASES}.${JASS_SUFFIX} |\ sed 's/^root:.*/root: hhoffman@ip-solutions\.net/g' > ${ALIASES} else backup_file ${ALIASES} echo "root: hhoffman@ip-solutions.net" >> ${ALIASES} fi if [ ! -f ${SENDMAILCONF} ]; then logNotice "The sendmail config file could not be found, I'm giving up now." else backup_file ${SENDMAILCONF} logMessage "Setting the Smart Host entry in the file, ${SENDMAILCONF}." cat ${SENDMAILCONF}.${JASS_SUFFIX} |\ sed 's/^DS.*/DSmail\.ip-solutions\.net/g' > ${SENDMAILCONF} fi