#!/bin/bash
# http://crystalfaeries.net/posix/bin/durs
# celeste:crystalfaery 2011-09-28 02:42:32+00:00
df -h
echo " "
sudo rsnapshot du > /tmp/$$.du.txt
echo "Snapshot_______ Size___ Date______ Time_"
cut --delim=" " -f 1 < /tmp/$$.du.txt > /tmp/$$.sizes.txt
cut --delim=" " -f 2 < /tmp/$$.du.txt \
| sed 's/\/\var\/cache\/rsnapshot\///' \
| sed 's/weekly/ weekly/' \
| sed 's/hourly/ hourly/' \
| sed 's/daily/ daily/'> /tmp/$$.names.txt
ls -Flt /var/cache/rsnapshot/ \
| tail -n +2 \
| cut --delim=" " -f 6-7 > /tmp/$$.times.txt
paste /tmp/$$.names.txt /tmp/$$.sizes.txt /tmp/$$.times.txt | sed 's/total */__total_ /'
echo " "
cd /tmp # in case no machine's backups exist.
if [ -d /var/cache/rsnapshot/hourly.0/kali ]
then
cd /var/cache/rsnapshot/hourly.0/kali
elif [ -d /var/cache/rsnapshot/hourly.0/muse ]
then
cd /var/cache/rsnapshot/hourly.0/muse
elif [ -d /var/cache/rsnapshot/hourly.0/localhost ]
then
cd /var/cache/rsnapshot/hourly.0/localhost
fi
if [ "/tmp" == "`pwd`" ]
then
vi $0 +29
exit 1
fi
sudo nice find . -type d -exec du -s {} \; | sort -rn
syntax highlighted by Code2HTML, v. 0.9.1