When running a Job it is often highly useful to get a notification on completion (or failure) currently this happens automatically, without the user knowing — with the exception of the occasional terminal message.
Where is mail stored?
By default, all correspondence is stored at
/var/mail/<short 6 character username>
If you are unsure what your username is, type
echo '/var/mail/$USER' to get the path. This gives a list of messages outlining your different runs, and their final status.
Alternatively typing in
"mail” opens the terminal client and lets you browse messages more readily if you wish to use this method.
Setting up a forwarding address
This is done by creating a
.forward file in your
$HOME directory. This can be done using a
cat > $HOME/.forward
next, you enter your preferred email and hit carriage return — e.g.
email@example.com <press enter key>
And exit using
< ctrl+d > .
Finally, we change the permissions of this file with
chmod 600 $HOME/.forward
Sending a test email
Finally to make sure it is all working as intended we send ourselves a test email using:
$USER just substitutes your username. You can type this manually if you wish.
This will prompt you for an email subject
Subject: Lets test this mail
After pressing the enter key we can then go ahead and enter our message content.
This is a not-so creative email body. Yours Sincerely,
When you are done press the enter key again and
< ctrl + d > to end the message.
Open the email in your
.forward file, and you should have the message you just typed sitting in your mailbox!
I presume you might be able to email other users in the same format, although this has not been tried — have fun!
Extra — debugging
If you wish to add a debug email as test — e.g. within the cleanup text for a Unified Model run you can use the following one-liner:
mailx -s "my-subject" $USER <<<$'\n Body Text \n'
It would also be able to pipe the contents of a text file into the message if needed.