Here is a quick tip on how to receive an e-mail alert if your linux server or linux VPS restarts:
1. Log into your linux server or VPS using ssh.
2. Type in
crontab -e into the commandline.
Depending on the default text editor, it could be
nano or
vi. Here are the directions for vi:
3. Press
insert button on your keyboard.
4. Then type in
@reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" you@yourdomain.com
5. Then type in
:wq to save and quit the vi text editor.
If your default text editor is nano, then the commands to type in are:
3. Find a new line or create one by pressing the Enter key.
4. Now type in on one line:
@reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" you@yourdomain.com
5. Then press
CTRL and
X on the keyboard to save.
6. Press
Y to save the changes. Press
Enter to exit.
If you want to send the e-mail to multiple people, edit the line to show this instead:
@reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" -c "user2@yourdomain.com" you@yourdomain.com
Now you will receive an e-mail alert when your server or VPS reboots. Very handy in troubleshooting issues with your VPS provider or your own server.