My script looks essentially like this:
cp -al $yesterdays_snapshot $todays_snapshot
rsync -vadlH --exclude-from excludes.rsyc $source $todays_snapshot
This works great except for one problem:
If yesterday I had no excludes, but then today I realize /directory/cache should be excluded, rsync stops looking at the cache, but the cp continues to copy it forward each day. After a while this means that the snapshots will have the contentsof /directory/cache from a year ago, which isn't the desired behavior. We don't want /directory/cache in the snapshot at all.
It would be better if rsync deleted /directory/cache from the newest snapshot.
Alternatively, it would be good if cp knew not to copy any files listed in excludes.rsync
I can write a function that manually deletes any excludes files from todays_snapshot, but it'll take a little hacking, and this feels like the sort of problem that has a ready-made answer out there.
Any suggestions?