#!/bin/bash

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

# 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]}"
                else
                        echo "정상"
                fi
        fi
        cnt=`expr $cnt + 1`
done

 

+ Recent posts