I'm not sure why this is not working as expected. I have a full rsync backup of /scripts/source in /scripts/full and want to put differential backup into /scripts/diff However, when a file is added to the origin location of /scripts/source and then a differential backup is run, the files are backed up to /scripts/full instead of /scripts/diff Here's a test script I made:
DIFF='/scripts/diff'
SOURCE='/scripts/source'
FULL='/scripts/full'
CTIME=$(date +%T)
TESTFILE=newfile$CTIME
rm -r $DIFF/*
rm $SOURCE/newfile*
rm $FULL/newfile*
echo "I'm in a file " > $SOURCE/$TESTFILE
rsync \
-a \
-A \
-X \
-h \
-H \
-b \
--backup-dir=$DIFF \
$SOURCE/* \
$FULL
echo "----------------------------------------------------------------------"
echo "Our test file is: $TESTFILE"
echo "----------------------------------------------------------------------"
echo "Source Files in $SOURCE - we should see our one test file"
ls $SOURCE
echo "----------------------------------------------------------------------"
echo "Full backup in past - We should not see any test files here"
ls $FULL
echo "----------------------------------------------------------------------"
echo "Diff files in $DIFF - we should see the same test file here as"
echo "was in the $SOURCE dir"
ls $DIFF
In the script, the test file gets dropped in the source directory. rsync should not copy it the full directory (but it does). It should be copied to the diff directory (it isn't).
Re-reading the man pages and searching the web has not helped. Simple differential backup schemes when adapted for my environment simply do not work. What am I doing wrong here? I want to do a full backup once in a while. Then I want to run subsequent diffs that contain only the changed files (while the full backup never changes). Idea being that there's a full backup to reference, and changed files can be found in the diff. My script is more complex than this, but I simplified it to isolate the issue. Thanks, -Jeff