Quite often you need to write scripts which need to email you urgent information, there is a very simply way to do this.
First we need to install an email server to transmit the emails.
1 |
sudo apt-get install postfix |
Then insert the following into your script.
1 |
mail -s "Host File" name@address.com < /etc/hosts |
In the above example it will email a copy of your local host file, change be change for any file you want transmitted.
See this script for a working example.