#! /bin/sh # # Filename: msize # # Programmers: Jasen M. Lentz, Br. David Carlson # # Date: 1-20-97 # # Revised: 12-17-87 by Br. David to run on the Linux machine # # Purpose: This program checks the size of the specified user's mail # queue and reports the size to the screen. If no command-line # parameter is specified, it gives the size of your mail queue. # # Syntax: msize # or # msize if [ $# -eq 0 ] then id=`whoami` elif [ $# -eq 1 ] then id=$1 else echo "Error: cannot have more than 1 parameter." echo "Syntax: msize " echo " or" echo " msize" exit 1 fi echo -n "Mail queue for $id " if [ ! -f /var/spool/mail/$id ] then echo "does not exist." exit 0 fi queue="/var/spool/mail/$id" lowerdigits=`ls -l "$queue" | cut -c 40-42 | tr -d ' '` upperdigits=`ls -l "$queue" | cut -c 33-39 | tr -d ' '` if [ "$lowerdigits" = "" ] then lowerdigits=0 fi if [ "$upperdigits" = "" ] then upperdigits=0 fi # Debug section: #echo #echo "lowerdigits :$lowerdigits:" #echo "upperdigits :$upperdigits:" if [ "$upperdigits" -eq 0 -a "$lowerdigits" -eq 0 ] then echo "is empty." elif [ "$upperdigits" -eq 0 ] then echo "is $lowerdigits bytes." else echo "is $upperdigits KB." if [ "$upperdigits" -gt 1000 ] then echo "Mail queue is too large (over 1 MB)." fi fi exit 0