There were of course a few 'deliberate' mistakes in that! :-)
There's a couple of fairly trivial ones in the rotate.sh script in paths that will only get tested on the first of the month. There's a rmdir that should be an 'rm -fr' and also an rm that should be 'rm -fr'.
The bigger and more subtle error is that since there are two calls to rsync in the backup script run on my desktop machine the rotate.sh script gets called twice on the backup NAS. That screws things up rather thoroughly! I've fixed it by calling rsync only once:-
#!/bin/sh export RSYNC_PASSWORD=XXXXX # # # Daily backup, copy everything important to the backup machine # rsync -a --port=874 \ --exclude tmp/ --exclude 'Mail/??/' --exclude .VirtualBox/ --exclude .gvfs/ \ --exclude .cache/ --exclude lost+found/ \ --link-dest=/old /etc /home chris@dlink::chris/new/
In a sense this, to my mind, exemplifies the "it just growed" complexity that many fundamentally simple programs get to. My immediate reaction to fixing the problem was to have some sort of flag passed from client to backup server to say 'do the rotate now'. Or I considered splitting up the rsyncd modules with only one executing the rotate.sh script.
However a bit of thought revealed that I could *simplify* things to make it work correctly. It isn't always possible of course but as sume guru somewhere said effort spent on design is well worth it though it often doesn't feel productive.