Updated on 9 Dec 2005

Shutdown Remote Server By UPS (PowerChute)

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.

To shutdown servers via network, you need special card called APC Web/SNMP Management Card which can send a shutdown event over the network.

To shutdown server via serial communication, you need as, 8-Port Share-UPS Interface Expander which can send a shutdown event over serial communication.

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.

Shutdown Remote Windows NT/2000/2003 servers

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".

This case, PsTools contains a command called PsExec which can run command on other computer with particular user's privilege as an Administrator.

  1. Download PsTools from http://www.sysinternals.com/ntw2k/freeware/pstools.shtml or download from this site.
    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.
  2. Just copy executable executable files under \winnt\ or others
  3. Make a batch file to shutdown (netshutdown.bat)

  4. psexec \\server1 -u Administrator -p passwd -c -f psshutdown.exe -t 10 -f -l
    psexec \\server2 -u Administrator -p passwd -c -f psshutdown.exe -t 10 -f -l
    psexec \\server3 -u Administrator -p passwd -c -f psshutdown.exe -t 10 -f -l
    
  5. Open PowerChute and select [Configuration] -> [Event Actions...] menu

  6. Select [System Shutdown Starting], check [Run Command File] and click [Options...]

  7. Type batch file name

Shutdown Remote Linux (or UNIX) servers

There is a free telnet software called Teraterm which supports macro language. So you can make a shutdown macro

  1. Download Teraterm and install it. http://www.vector.co.jp/authors/VA002416/teraterm.html (The address may be changed in future.)
  2. Make a macro script. example (C:\Program Files\TTERMPRO\ups.linux.ttl)
    ServerAddress = '123.123.123.123'
    UserName = 'ups'
    UsernamePrompt = '[ups@linux ups]$'
    
    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'
    
  3. Make a batch file to run macro. (example C:\Program Files\TTERMPRO\ups.linux.bat)

  4. "C:\Program Files\TTERMPRO\ttpmacro.exe" ups.linux.ttl "C:\Program Files\TTERMPRO\ttpmacro.exe" ups.linux2.ttl
  5. Run this script (C:\Program Files\TTERMPRO\ups.linux.bat) from PowerChute

Back - Support
Google
Web www.grape-info.com