国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 幫助中心 > 正文

Shell中使用plink工具實現遠程批量關機

2024-07-09 22:43:11
字體:
來源:轉載
供稿:網友

我的操作系統是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列表文件
復制代碼 代碼如下:
[root@localhost~]# vim server_list.txt

192.168.0.13
192.168.0.12
192.168.0.11

2、遠程主機要執行的操作的文件
復制代碼 代碼如下:
[root@localhost~]# vim shutdown.txt

shutdown -h now

3、遠程關機自動化腳本
復制代碼 代碼如下:
[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

4、腳本賦予執行權限x
復制代碼 代碼如下:
[root@localhost~]# chmod a+x remote_shutdown.sh

5、腳本運行
復制代碼 代碼如下:
[root@localhost~]# ./remote_shutdown.sh

注意:本人應用環境,所有主機root用戶密碼均為redhat,請根據實際環境調整,若無規律,可單條列出。

例如:
復制代碼 代碼如下:
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)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 顺平县| 新和县| 蓝田县| 六枝特区| 新兴县| 高安市| 从化市| 平和县| 克拉玛依市| 墨江| 萍乡市| 会宁县| 甘孜县| 古交市| 贡山| 镇远县| 关岭| 简阳市| 博罗县| 仁寿县| 海宁市| 大城县| 陈巴尔虎旗| 高青县| 瑞丽市| 胶州市| 西宁市| 凉山| 金乡县| 突泉县| 吴忠市| 锦州市| 邢台县| 抚州市| 五寨县| 广汉市| 萍乡市| 扶沟县| 松阳县| 绵竹市| 崇阳县|