Showing posts with label alert. Show all posts
Showing posts with label alert. Show all posts

Wednesday, April 10, 2013

Send e-mail alert when Windows Server reboots

Here is how you can send an e-mail alert when a Windows Server reboots. This has been tested on Server 2008, Small Business Server 2008, and Small Business Server 2012. It should work for Server 2012, but I have not had a chance to test this.

  1. Download sendemail.exe file and save it to a folder on server. I like to save it to a folder called C:\Scripts
  2. Open Notepad/Wordpad/Text Editor and add the following:
    c:\Scripts\sendemail.exe -f localadmin@domain.com -t alerts@yourdomain.com;alerts2@yourdomain.com -u "SERVERNAME rebooted" -m "SERVERNAME has rebooted!" -s smtp.ispsmarthost.com
  3. Save the file as rebootalert.cmd in the C:\Scripts folder.
  4. Open Task Scheduler.
  5. Add a new Task and call it Reboot Alert. Set the User to be SYSTEM. Set Trigger to be At System Startup. Set Actions to be Start a Program and add the path C:\Scripts\rebootalert.cmd.
Test the script by rebooting the server. You should receive an e-mail alert that the server rebooted.

Other helpful links:
http://glazenbakje.wordpress.com/2012/12/30/exchange-2013-how-to-configure-an-internal-relay-connector/

http://www.bluecompute.co.uk/blogposts/configure-email-notification-for-windows-server-backup/

Thursday, June 7, 2012

How to receive an e-mail alert when your linux server or linux VPS restarts

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.