linux下plink工具远程批量关机shell脚本

本文发布时间: 2019-Mar-22
操作系统:rhel 6.2 x86_64下载并安装putty软件包,本人下载了putty-0.62-1.el6.rf.x86_64.rpm下载地址如下:http://rpm.pbone.net/index.php31、远程主机IP列表文件[root@localhost~]# vim server_list.txt192.168.0.13192.168.0.12192.168.0.112、远程主机要执行的操作的文件[root@localhost~]# vim shutdown.txtshutdown -h now3、远程关机自动化脚本[root@localhost~]# vim remote_shutdown.shfor i in `cat server_list.txt`doplink -l root $i -pw redhat -m /shutdown.txt <<EOFyEOFdone4、脚本赋予执行权限x[root@localhost~]# chmod a+x remote_shutdown.sh5、脚本运行[root@localhost~]# ./remote_shutdown.sh注意:本人应用环境,所有主机root用户密码均为redhat,请根据实际环境调整,若无规律,可单条列出。例如:vim remote_shutdown.shplink -l root 192.168.0.12 -pw password1 -m /shutdown.txtplink -l jane 192.168.0.35 -pw password2 -m /shutdown.txtplink -l paul 192.168.0.77 -pw password3 -m /shutdown.txtplink -l root 192.168.0.19 -pw password4 -m /shutdown.txt(或 plink [email protected] -pw password4 -m /shutdown.txt)本文出自 “up” 博客


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表