rcbatlinux
Technical User
I'm working on a script to do a df -k | grep "SDI" for specific file systems and from there awk out the 3rd column and compare the value to a specified size that I feel I need to react on. I am using ksh. In essence:
df -k | grep "SDI"
if $3rd column < 300000 then do this
else
do that
fi
I've been dabling with awk, nawk and a for loop but I want to do this by performing the df command once. For example I have:
for diskspace in `df -k | grep "SDI" | awk '{print $3'`
do
if [ $diskspace < 300000 ]
then
echo "$diskspace Problem!"
else
echo "Ok"
fi
done
Works fine BUT! I want to list with the echo "Problem!" the directory that is involved as well. But I've tried feeding in the entire line and awk out the columns I need in the if statement but can't seem to get it to work. Any ideas??
rcbatlinux
df -k | grep "SDI"
if $3rd column < 300000 then do this
else
do that
fi
I've been dabling with awk, nawk and a for loop but I want to do this by performing the df command once. For example I have:
for diskspace in `df -k | grep "SDI" | awk '{print $3'`
do
if [ $diskspace < 300000 ]
then
echo "$diskspace Problem!"
else
echo "Ok"
fi
done
Works fine BUT! I want to list with the echo "Problem!" the directory that is involved as well. But I've tried feeding in the entire line and awk out the columns I need in the if statement but can't seem to get it to work. Any ideas??
rcbatlinux