<html>
<head>
<title>Shutdown Remote Server By UPS (PowerChute)</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="../css0.css">
</head>
<body>

<!--#include virtual="/doc/header.html" -->

<p align="right">Updated on 9 Dec 2005</p>

<h1>Shutdown Remote Server By UPS (PowerChute)</h1>
<p>For power management, what system administrator wants to do 
is that all servers should be power off automatically when power goes off.
This case, each and every server should have a com connection to UPS.
But sometime, we connect several servers to one UPS and other server 
which doesn't have a com connection can not have a shutdown event.</p>

<p>To shutdown servers via network, you need special card called 
<a href="http://www.bomara.com/APC/web-snmp-card.htm" target="_blank">APC Web/SNMP Management Card</a>
which can send a shutdown event over the network.</p>

<p>To shutdown server via serial communication, you need as, 
<a href="http://www.apc.com/resource/include/techspec_index.cfm?base_sku=AP9207" target="_blank">
8-Port Share-UPS Interface Expander</a> which can send a shutdown event over serial communication.</p>

<p>If you do not have above, PowerChute still can launch executable command file, when it is about to shutdown.
At the event, PowerChute can send shutdown events to other servers.</p>

<h2>Shutdown Remote Windows NT/2000/2003 servers</h2>

<p>If we use shutdown.exe (Windows Resource Kit) or PsShutdown (clone of shutdown.exe and Free Software), we can shutdown remote computer. But PowerChute doesn't run as an Administrator privilege. If you run simply psshutdown.exe from PowerChute, message shows "Access dennied".<p>

<p>This case, <a href="http://www.sysinternals.com/Utilities/PsTools.html" target="_blank">PsTools</a> contains a command called PsExec which can run command on other computer with particular user's privilege as an Administrator.</p>

<ol>
<li>Download PsTools from <a href="http://www.sysinternals.com/ntw2k/freeware/pstools.shtml" target="_blank">http://www.sysinternals.com/ntw2k/freeware/pstools.shtml</a> or download from <a href="http://www.grape-info.com/doc/win2000srv/power/Pstools.zip">this site</a>.<br>Notice: The new PsShudown changed its parameters, and the example on this sites does not work as it is. In such case, use the copy on this site, or change the parameter accordingly.

<li>Just copy executable executable files under \winnt\ or others</li>

<li>Make a batch file to shutdown (netshutdown.bat)</li><br>
<pre>
psexec \\server1 -u Administrator -p <b>passwd</b> -c -f psshutdown.exe -t 10 -f -l
psexec \\server2 -u Administrator -p <b>passwd</b> -c -f psshutdown.exe -t 10 -f -l
psexec \\server3 -u Administrator -p <b>passwd</b> -c -f psshutdown.exe -t 10 -f -l
</pre>

<li>Open PowerChute and select [Configuration] -> [Event Actions...] menu
<img src="psshutdown01.gif"><p>

<li>Select [System Shutdown Starting], check [Run Command File] and click [Options...]</li><br>
<img src="psshutdown02.gif"><p>

<li>Type batch file name</li><br>
<img src="psshutdown03.gif"><p>

</ol>

<h2>Shutdown Remote Linux (or UNIX) servers</h2>
<p>There is a free telnet software called Teraterm which supports macro language. So you can make a shutdown macro</p>

<ol>
<li>Download Teraterm and install it. http://www.vector.co.jp/authors/VA002416/teraterm.html (The address may be changed in future.)</li><p>

<li>Make a macro script. example (C:\Program Files\TTERMPRO\ups.linux.ttl)
<pre>
ServerAddress = '<b>123.123.123.123</b>'
UserName = '<b>ups</b>'
UsernamePrompt = '<b>[ups@linux ups]$</b>'

connect ServerAddress

; set username
UsernamePrompt = 'login:'
Username = UserName
PasswordPrompt = 'Password:'
; get password from file
getpassword 'ups.pwd' 'ups' Password

; login
wait   UsernamePrompt
sendln Username

wait   PasswordPrompt
sendln Password

; set username
Username = 'su - root'
PasswordPrompt = 'Password:'
; get password from file
getpassword 'ups.pwd' 'root' Password

; login
wait   UsernamePrompt
sendln Username

wait   PasswordPrompt
sendln Password

; OK, auto login complete and Shutdown
sendln 'halt'
sendln 'exit'
sendln 'exit'
</pre>

<li>Make a batch file to run macro. (example C:\Program Files\TTERMPRO\ups.linux.bat)</li><br>
<pre><blockquote>"C:\Program Files\TTERMPRO\ttpmacro.exe" ups.linux.ttl
"C:\Program Files\TTERMPRO\ttpmacro.exe" ups.linux2.ttl
</blockquote></pre>

<li>Run this script (C:\Program Files\TTERMPRO\ups.linux.bat) from PowerChute
</ol>

<hr><a href="../index.html">Back</a> - <a href="../../support.html">Support</a>

<!--#include virtual="/doc/footer.html" -->

</body>
</html>
