Listing 2: du_daily -- Runs the daily du commands and starts reportgen

 #!/bin/sh
 # du_daily :run the daily  du commands and start reportgen.
 # lines marked with DEP must be looked at per installation

 # set NOT to: extra top-level directories NOT to visit
 # (restriction: NOT args must be in rootdir)
    NOT='eras mnt pcfs cdrom'                            # DEP

 # set AFS to the list of mounted filesystems to visit
 # (use "root" for rootfilesystem)
 # (restriction: AFS args must be in rootdir)
 AFS="root home0 home1 home2 home3 home4 usr"            # DEP

 # User to mail to
 UMAIL="root"                                            # DEP

 # Days to retain old du-files in olddates with du_clean
 NDAYS=3                                                 # DEP

 ###########                                             # END-DEP

 rootd(){

 # To run du on the root filesystem it is not ok to
 # run:  "du /" since that will run on mounted filesystems
 # as well. So we have to select all but the mountpoints

 KILL="^/$"
 for i in  $NOT
 do
         KILL=$KILL"|^/$i\$"             # create egrep regexp
 done

 find / -mount -type d -print |
         sed '/\/.*\//d' | egrep -v "$KILL"
 }

 EXT=`date '+%y%m%d'`                   # todays extension

 for fs in $AFS
 do
         if test $fs = root
         then
                nice -10 du `rootd`  >$EXT.$fs
         else
                 nice -10 du /$fs   >$EXT.$fs
         fi
 done

 # Start fss_daily with user to mail to, and reporttype
 # If all ends well, clean up all but keep NDAYS days and
 # the 1st. of each month
 ./fss_daily "$UMAIL" "->+" $EXT $AFS && ./du_clean $NDAYS $AFS
