Do you want your OpenIndiana instance to let you know when something has gone wrong or if a cron
job has failed? Here's how you do it.
First, tell the operating system to email you if anything goes into the maintenance, offline, or degraded states:
# svccfg setnotify -g to-maintenance,to-offline,to-degraded mailto:YourEmailAddress
For failed cron
jobs and the like, add the following lines to /etc/mail/aliases
:
root: YourEmailAddress
YourUsername: YourEmailAddress
Ensure there are no other conflicting root
& YourUsername
definitions (read: lines beginning with either of those.) If there are, either comment them out or resolve the conflicts using the commented instructions in the file.
Save /etc/mail/aliases
when you're done editing, then run the following in the terminal:
# newaliases
Now test your config by sending an email directly to YourEmailAddress
¹, checking its inbox each time:
echo "This is the body of the email" | mail -s "This is the subject line" YourEmailAddress
Then try sending an email to root
:
echo "This is the body of the email" | mail -s "This is the subject line" root
Finally, try sending an email to YourUsername
:
echo "This is the body of the email" | mail -s "This is the subject line" YourUsername
Those should all work.
¹ The emails I sent using this method did not have a subject line, so the -s
might not work OpenIndiana. To be honest, I stole this line from Debian tutorial, so 🤷♂️. In any case, automated emails will have their own programmatically generated subject lines and bodies.
Top comments (0)