APC PCNS不支持的Unix网络关机解决方案
编辑:admin 时间:2010-1-17 11:46:29 来自:UPS电源网
很多Unix用户希望能提供通过网络正常关闭UPS保护的服务器的解决方案,但是他们使用的是PowerChute Business Edition或PowerChute Network Shutdown无法支持的操作系统。
为了支持这样的操作系统,我们提供了一个脚本范例,可以通过网络远程关闭这类Unix服务器。如果在PowerChute Network Shutdown 或PowerChute Plus(配合Interface Expander或Share-UPS使用)都无法支持该操作系统的情况下,可以使用该方法。
Solution:这个例子可以在Solaris服务器上正常运行。如果用户使用其他版本的Unix,请根据其版本做相应的修改。
具体内容参考操作系统用户手册与rsh(remote shell)相关的内容。
1. 在支持PowerChute Network Shutdown 或PowerChute Plus的Server1上安装这个脚本,安全关闭其他服务器的工作由Server1完成。
2. Server2是希望受Server1控制完成安全关机功能的服务器。
3. 我们的脚本范例的文件名称是shut.sh。文件内容如下:
#!/bin/sh
#Script remotely executes shutdown command
rsh -n -l root server2 /usr/sbin/shutdown -y -g 60 -i 0
#root is the logon user account this machine is using to log onto the remote server
#called server2
#the remote command executed is "shutdown" with the appropriate switches for
#Solaris.
#The root account must be trusted on the remote servers in order for "rsh" to work.
#To trust a remote system using the root account, the .rhosts file must include the
#server Name/IP of the trusted system and the trusted user account.
#The format for .rhosts is as follows:
# server name/ip address root
# 159.216.77.215 root
#Review the MAN (manual pages for rsh) to get more information
4. 用户必须创建.rhosts以使我们的范例脚本可以执行。.rhosts文件必须放在root用户目录下。
注意:对系统安全性要求性比较高的用户不宜采用该方法。
浏览过此文章的人还浏览过:

