Article Listing 1 Listing 2 Listing 3 Listing 4
Listing 5 Listing 6 Listing 7 Listing 8 Listing 9
Listing 10 oct96.tar

Listing 7: space.chk

:
#######################################################
# space.chk - free disk space check.
#######################################################
# If disk space %used is less than 100, then exit 0,
# else exit 1.

# assume pwd unless directory specified on command-line.
test $# -eq 1 && dir=$1 || dir=.

/usr/bin/bdf $dir |
awk 'NR == 2 {
x=$5
sub(/%/, "", x)
if ( x < 100 )
exit 0
exit 1
}'
exit $?