一个检查本机和远程机器的根目录所在磁盘的剩余空间的bash小脚本

上星期写的,参考的网页也不记得了。

#!/bin/bash

# List remote machine df output
echo "On drivers:"
clients=("10.245.109.216" "10.245.109.217" "10.245.109.218" "10.245.109.219" "10.245.109.220" "10.245.109.221" "10.245.109.222" "10.245.109.223")
for i in ${!clients[@]};
do
    ip=${clients[$i]}
    ssh $ip hostname
    ssh $ip "df -h | grep root "
done

# List local machine df output
echo "On controller:"
df -h | grep root


供参考和进一步的改造。

posted on 2020-11-03 14:17  中道学友  阅读(135)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上