[root@localhost~]# vim server_list.txt
192.168.0.13
192.168.0.12
192.168.0.11
[root@localhost~]# vim shutdown.txt
shutdown -h now
[root@localhost~]# vim remote_shutdown.sh
for i in `cat server_list.txt`
do
plink -l root $i -pw redhat -m /shutdown.txt EOF
y
EOF
done
注意:本人應(yīng)用環(huán)境,所有主機(jī)root用戶密碼均為redhat,請(qǐng)根據(jù)實(shí)際環(huán)境調(diào)整,若無規(guī)律,可單條列出。
vim remote_shutdown.sh
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)