批量安装nagios客户端

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/bash
#!/usr/bin/expect -f
#!/usr/bin/env bash
for line in `cat nagios.ip`
do
cmd1="scp ./nagios_client.sh  $line:~/"
cmd2="ssh root@$line"
expect -c "set timeout 20;
spawn $cmd1;
spawn $cmd2;
set timeout 1200;
expect "*@*";send "./nagios_client.sh\\r";
expect "*@*";send "exit\\r";
expect eof;"
done