How to set up email notifications on OpenIndiana

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.

from jdrch https://dev.to/jdrch/how-to-set-up-email-notifications-on-openindiana-4a0f
via IFTTT

Author: jdrch

ISTJ, Rice Owl, UF Gator, mechanical engineer. STEM, sports, music, movies, humor. Account mine only & unaffiliated.

One thought on “How to set up email notifications on OpenIndiana”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s