Last active
October 23, 2020 00:18
-
-
Save nestoru/d619bb48cc770e07b0ad to your computer and use it in GitHub Desktop.
How to forward all Solaris user emails to an external email account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
I suggest asking that question in stackoverflow. This gist is about forwarding system emails to the outside.