时间:2021-09-02 10:08:15 | 栏目:Shell | 点击:次
我的操作系统是centos6.4
操作系统:rhel 6.2 x86_64
下载并安装putty软件包,本人下载了putty-0.62-1.el6.rf.x86_64.rpm
下载地址如下:http://rpm.pbone.net/index.php3
1、远程主机IP列表文件
192.168.0.13
192.168.0.12
192.168.0.11
shutdown -h now
3、远程关机自动化脚本
for i in `cat server_list.txt`
do
plink -l root $i -pw redhat -m /shutdown.txt <<EOF
y
EOF
done
注意:本人应用环境,所有主机root用户密码均为redhat,请根据实际环境调整,若无规律,可单条列出。
例如:
plink -l root 192.168.0.12 -pw password1 -m /shutdown.txt
plink -l jane 192.168.0.35 -pw password2 -m /shutdown.txt
plink -l paul 192.168.0.77 -pw password3 -m /shutdown.txt
plink -l root 192.168.0.19 -pw password4 -m /shutdown.txt
(或 plink root@192.168.0.19 -pw password4 -m /shutdown.txt)