/etc/cron.daily/durep is in durep 0.9-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #!/bin/sh
# rolling disk usage reporting
# uses durep to save disk usage reports
# designed to be run each day from /etc/cron.daily
# so that you can look back over the past week to try and isolate where
# changes in disk space are happening
# also takes a snapshot once a month for longer term changes
# so you can look back up to one year
# to get a copy of durep, try googling for "durep"
# or use the durep package in debian
# tested and used on GNU Linux using bash
# GNU cp option --target-directory used, might not work on non-GNU systems
# $Id: durep-rolling,v 1.7 2002-12-15 12:53:37+11 matthewa Exp matthewa $
# this cron script by Matthew Arnison <maffew@cat.org.au>
# ideas pilfered from a backup script by Daniel O'Callaghan <danny@freebsd.org>
# to use: edit /etc/default/durep-rolling and add some filesystems
# to be reported on each night
# config
LANG=C
export LANG
test -f /etc/default/durep-rolling || exit 0
. /etc/default/durep-rolling
test -x $DUREP || exit 0
test -n "$FILESYSTEMS" || exit 0
# action
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
MONTH=`date +%b` # Just the month name, e.g. Aug
for FS in $FILESYSTEMS; do
# change slashes to underscores so that we can use the
# file system names as folder names
# only minimal protection but hopefully people won't put
# totally outlandish paths in FILESYSTEMS
FSSAFE=`echo $FS | tr '/' '_'`
ONEFS="-x"
if [ "$FS" = "." ] ; then
FS=/
unset ONEFS
fi
DUREP_TODAY="$DUREP_DATA_PATH/${FSSAFE}_$(date +%Y_%m_%d)_${DOW}_${DOM}"
if [ $DEBUG = "on" ]; then
echo "FS \"$FS\""
echo "DUREP_TODAY \"$DUREP_TODAY\""
echo "."
else
$DUREP -td 2 -d 'durep-rolling' -hs $SIZE_CUTOFF -sf $DUREP_TODAY $ONEFS $FS > $DUREP_TODAY.Summary.txt
# disable for now, needs a reimplementation for CGI when requested
# I imagine something like following on the HTML page:
#
# Display filters: [x] all [ ] daily [ ] weekly [ ] monthly <UPDATE>
# (cd $DUREP_TODAY ; $POSTEXEC)
#
# if [ $DOM = "01" ]; then # monthly snapshot
# # being careful here not to create lots of duplicate
# # subfolders if this script gets run more than once on
# # the first day of the month
# mkdir -p $DUREP_WEB_PATH/$FSSAFE/$MONTH
#
# # --target-directory option is presumably only
# # in GNU cp
# cp -urp \
# --target-directory=$DUREP_WEB_PATH/$FSSAFE/$MONTH \
# $DUREP_TODAY/*
# fi
fi
# prune old database files
find "$DUREP_DATA_PATH" -type f -mtime "$DUREP_MAXAGE" -print0 | \
xargs -0 -r rm
# copy the previous register file before the updating rebuild
test ! -f "$DUREP_DATA_PATH"/durep.cds ||
cp -a "$DUREP_DATA_PATH"/durep.cds "$DUREP_DATA_PATH"/durep.cds.old
# update the index
$DUREP -c "$DUREP_DATA_PATH"
done
|