#!/bin/bash
#                 /usr/local/bin/backups
# http://crystalfaeries.net/posix/bin/backups
# celeste:crystalfaery	2013-10-26 09:55:46+00:00
# list what is backed-up and the size thereof, and what is excluded from back-up
# note there are two levels of backup / exclusion combined...
# first  is the backup  by   rsnapshot  to		/var/cache/rsnapshot
# second is the backup from /var/cache/rsnapshot by darchive
# obviously if it was not backed-up by rsnapshot, darchive never sees it
# this helps us choose what to backup or exclude based on size when space limited
for f in $(cat /etc/darexclude) ;do
	echo "excludar	/$f"
done > /tmp/$$.exclude.txt
grep backup /etc/rsnapshot.conf | grep -v \# | sed 's/\t\t/\t/g ; s/\tkali\/$// ; s/\tmuse\/$// ; s/\tlocalhost\/$//' >> /tmp/$$.exclude.txt
grep exclude /etc/rsnapshot.conf | grep -v \# | sed 's/\t\t/\t/g' >> /tmp/$$.exclude.txt
sudo nice find /var/cache/rsnapshot/hourly.0/ -type d -exec du -s {} \; | sed 's/\/var\/cache\/rsnapshot\/hourly.0// ; s/\t\t/\t/g ; s/\t\/kali/\t/ ; s/\t\/muse/\t/ ; s/\t\/localhost/\t/' >> /tmp/$$.exclude.txt
sed 's/\t\t/\t/ ; s/\t$//' < /tmp/$$.exclude.txt | sort -u -k 2


syntax highlighted by Code2HTML, v. 0.9.1