#!/bin/sh # *********************************************************************** # # * * # # * Copyright (c) 1996-1999 Scott Crevier * # # * All Rights Reserved Worldwide * # # * * # # * This program product material is the property of Scott Crevier. * # # * This program may be used and modified by anyone free of charge, * # # * as long as this copyright notice remains in tact. By using this * # # * code, you agree to indemnify Scott Crevier from any liability * # # * that might arise from its use. * # # * * # # * scott@crevier.org - Scott M. Crevier - www.crevier.org * # # *********************************************************************** # # * smcDisku.sh v 2.0 22-Dec-1998 * # # *********************************************************************** # #****************************************************************# #* Set these variables. *# #****************************************************************# webdir=/usr/www/users/${LOGNAME}; # path to your web directory homedir=${HOME}; # path to your home directory maxKb=25000; # your max disk space allottment #****************************************************************# #* Get the used disk space in the two directories. *# #****************************************************************# homeKb=`du -sk ${homedir} | cut -f1` webKb=`du -sk ${webdir} | cut -f1` #****************************************************************# #* Do some math. *# #****************************************************************# usedKb=`expr $webKb \+ $homeKb` availKb=`expr $maxKb \- $usedKb` #****************************************************************# #* Print the results. *# #****************************************************************# sep="--------------------------------------------" echo $sep echo "Disk Space Usage in Kilobytes" echo "-----------------------------" echo ${webKb} | awk '{printf "Web : %5s\n", $1}' echo ${homeKb} | awk '{printf "Home: + %5s\n", $1}' echo ${maxKb} | awk '{printf " ------- %16s Max Allowed\n", $1}' echo ${usedKb} | awk '{printf "%13s -------> - %5s Total Used\n", $1, $1}' echo " -------" echo ${availKb} | awk '{printf "%30s Available\n", $1}' echo $sep if [ ${availKb} -lt 0 ] then echo " YOUR DISK USAGE HAS EXCEEDED ITS LIMIT!" echo $sep fi #****************************************************************# #* Done. *# #****************************************************************# exit 0