update to solaris file system check
#!/bin/bash
TMP_FILE=/tmp/disk_usage.tmp.$$
df -h | grep '%' | grep -v "/cdrom/" | tr -d '%' | awk '{
if (NR != 1) {
if (NF == 6 && $5 >= 95)
print $2,$3,$4,$5"%",$6;
else if (NF == 5 && $4 >= 95)
print $1,$2,$3,$4"%",$5;
}
}' >$TMP_FILE
if [ -s $TMP_FILE ]; then
cat $TMP_FILE | sort -rnk4 | head -1
rm -f $TMP_FILE
exit 2
fi
df -h | grep '%' | grep -v "/cdrom/" | tr -d '%' | awk '{
if (NR != 1) {
if (NF == 6 && $5 >= 90)
print $2,$3,$4,$5"%",$6;
else if (NF == 5 && $4 >= 90)
print $1,$2,$3,$4"%",$5;
}
}' >$TMP_FILE
if [ -s $TMP_FILE ]; then
cat $TMP_FILE | sort -rnk4 | head -1
rm -f $TMP_FILE
exit 1
fi
rm -f $TMP_FILE
echo OK
exit 0
Leave a Reply