Skip to content

Commit

Permalink
Add shell script to check the size of a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Greer committed Jul 6, 2011
1 parent 27209bb commit 7f6e144
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dir_size.sh
@@ -0,0 +1,20 @@
#!/bin/bash

MINS=$1
MAXS=$2
DIR=$3

if [ ! -d $DIR ]; then
echo "status err $DIR does not exist"
exit
fi

SIZE="`du -sm $DIR | awk '{ print $1 }'`"

RES="ok"
if [ $SIZE -lt $MINS ] || [ $SIZE -gt $MAXS ]; then
RES="err"
fi

echo "status $RES $DIR is ${SIZE}MB"
echo "metric dir_size int ${SIZE}"

0 comments on commit 7f6e144

Please sign in to comment.