Is it possible to restart a computer in response to an email notification?
You want a device called a "Remote Power Switch", one that we have used at my workplace to remotely restart cable modems is the UIS-322b below:
You can set it up with an IP address, and then log in to it to power on, power off, or power cycle either device connected, and set it on a schedule. You cannot control it via email, but through the web interface. You could still rig something up via wget
or curl
to automatically send a web request to it. It may have other features and control possibilities I'm unaware of.
If you are running rendering systems that consume a lot of power I am not sure if the specific device above can handle them, but there may be others out there that do. Another thing to look for is "Controllable Power Strip."
Can I setup a program, event, or a script that will tell the machines to reboot?
It depends on what you mean by:
they freeze or "stall"
If the remote machine has hung in a way that requires a "hard reset" then a remote restart will not work.
Having said that, you can use shutdown
to remotely restart a device.
Example:
shutdown /r /f /m \\computer
/r
- Shutdown and restart the computer./f
- Force running applications to close without forewarning users./m \\computer
- Specify the target computer.
You can run the above command from Outlook when you receive the appropriate email.
The following link How To: Trigger an application via email in Outlook should get you started.
shutdown
usage
F:\test>shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
No args Display help. This is the same as typing /?.
/? Display help. This is the same as not typing any options.
/i Display the graphical user interface (GUI).
This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is
rebooted, restart any registered applications.
/a Abort a system shutdown.
This can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning.
Can be used with /d and /f options.
/h Hibernate the local computer.
Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-315360000 (10 years), with a default of 30.
If the timeout period is greater than 0, the /f parameter is
implied.
/c "comment" Comment on the reason for the restart or shutdown.
Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users.
The /f parameter is implied when a value greater than 0 is
specified for the /t parameter.
/d [p|u:]xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined.
If neither p nor u is specified the restart or shutdown is
unplanned.
xx is the major reason number (positive integer less than 256).
yy is the minor reason number (positive integer less than 65536).
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- shutdown - Shutdown the computer.
If you have actual servers, they likely have a remote management feature that can be connected to even if the machine's main OS is completely frozen. Generally, you use SSH to connect to the controller. The specific command issued depends on the brand of your server.
For a Dell servers, which use DRAC (Dell Remote Access Controller), the command to execute after SSH'ing into the DRAC is:
racadm serveraction hardreset
That performs a hard reset, equivalent to yanking out the power cord and then restarting the machine. If the machine isn't completely hung, powercycle
instead of hardreset
might do the job. (Source.)
HP servers use iLO, which is also accessible over SSH. The hard reset command is simply:
reset hard
(Source, the official PDF reference to iLO scripting.)
You can wire up the e-mail receiving to the execution of these commands with DavidPostill's answer. There are SSH clients for Windows; I believe PuTTY has a command-line interface.