Skip to content

Instantly share code, notes, and snippets.

  • Save nde1/5c204105214c4ff0d28f9a2fafce4b56 to your computer and use it in GitHub Desktop.
Save nde1/5c204105214c4ff0d28f9a2fafce4b56 to your computer and use it in GitHub Desktop.
How to forward all Solaris user emails to an external email account
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/mail/aliases
echo "$user:$alertlist" >> /etc/mail/aliases
/opt/csw/bin/gsed -i "/root:/d" /etc/mail/aliases
echo "root:$alertlist" >> /etc/mail/aliases
newaliases
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment