一个检查本机和远程机器的根目录所在磁盘的剩余空间的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
供参考和进一步的改造。