3

As a Solaris user, I want cron jobs generated emails for the localuser@server to be forwarded to my [email protected] email account, so that I read only one inbox.

To resolve this I have forwarded localuser to [email protected] and according to the aliases test it does work as expected:

 $ sudo sendmail -v -bv localuser
 Password: 
 localuser... aliased to [email protected]

The mconnect command also confirms the alias is set.

However any communication from cron seems to not use aliases:

Mar 14 17:54:27 localuser sendmail[9249]: [ID 801593 mail.info] s2ELsRC2009249: from=localuser, size=13, class=0, nrcpts=1, msgid=<[email protected]>, relay=localuser@localhost

Mar 14 17:54:28 localuser sendmail[9249]: [ID 801593 mail.info] s2ELsRC2009249: to=localuser, ctladdr=localuser (100/1), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30013, relay=smtp.sample.com. [192.168.0.2], dsn=2.0.0, stat=Sent ( <[email protected]> Queued mail for delivery)

This results in errors of course in smtp.sample.com as user localuser does not exist there.

Any ideas how can I debug what is happening?

1 Answer 1

1

As posted in http://thinkinginsoftware.blogspot.com/2014/06/devops-need-no-words-but-code-how-to.html here is the answer. I know ot is not recommended to edit *cf files directly so you know the drill. Hopefully it will help somebody out there.

smarthost=mail.sample.com
user=me
[email protected]
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/submit.cf
/opt/csw/bin/gsed -i "s/^DS[\s]*.*/DS $smarthost/g" /etc/mail/sendmail.cf
/opt/csw/bin/gsed -i "/$user:/d" /etc/aliases
echo "$user:$alertlist" >> /etc/aliases
/opt/csw/bin/gsed -i "/root:/d" /etc/aliases
echo "root:$alertlist" >> /etc/aliases
svcadm restart sendmail
echo "So that we never miss again an important communication from servers" | mailx  -s "`hostname` As a sysadmin I want to receive my user mail notifications in my personal email address" me
echo "So that we never miss again an important communication from servers" | mailx  -s "`hostname` As a sysadmin I want to receive root mail notifications in my personal email address" root

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .