#! /bin/bash
machine_list=serverList
lineno=`cat $machine_list |wc -l`;
for((i=1; i<=lineno; i++)) {
line=`sed -n "$i p" $machine_list`;
machine=`echo $line | gawk -F" " '{ print $1 }'`;
path='/var/log/httpd/logs/lumen.log';
file=`echo $path`;
echo "INFO: "$file"@"$machine;
ssh $machine "df -h;echo ;echo";
}
exit 0;
原理就是循环一个ip列表
ssh并执行命令