ssh user@10.10.10.10 '

# limit : 디스크 용량 비율(%)
limit=80

# disk : 체크하고자 하는디스크 볼륨
disk="/dev/root"

mount_used=(`df -h`)
cnt=0

for mount_used_item in ${mount_used[*]}
do
        if [[ "$mount_used_item" == "$disk" ]]; then
                cnt3=$cnt
                cnt2=`expr $cnt + 4`
                used="${mount_used[$cnt2]::-1}"

                if [ $used -ge $limit ]; then
                        echo "사용률:${mount_used[$cnt2]}, 디렉토리: ${mount_used[$cnt3]}"
                        exit 1 # Build Failed
                else
                        echo "Check free disk space : success"
                        exit 0 # Build Success
                fi
        fi
        cnt=`expr $cnt + 1`
done
'

+ Recent posts