How to receive or forward root emails in Linux

I find the following way the easiest way to manage who gets root's emails.

Open the file /etc/aliases for editing
vi /etc/aliases
Go to the bottom of the file where you see something similar to :
 # Person who should get root's mail
 #root:          marc
Change marc to the email address of the user who should get the email and finally uncomment the line. So for example your last two lines of /etc/aliases should look like:
# Person who should get root's mail
root:          you@yourcompany.com
Last step is to issue the following command ro reload /etc/aliases
newaliase

How to take a Java thread dump from a shell/bash script

We already know how to get a Java thread dump manually. But what if we want to take a Java thread dump from a script to help us automate things.

To do this we need to come up with a ps and grep combination that will only return one result. so grep as many times as neccessary and/or use keywords that are only found in your process name so you only get one result.

Remember to add [] somewhere in your first grep so grep doesn't matches itself.
output=$(ps -ef | grep m[y]ProcesseName )
Then all you need to do is sending the QUIT signal to $2 which stores the PID of your process.
kill -QUIT $2
So just add the above two lines to your script after modifying the first line to fit your needs and you should be good to go.