Hello everyone. A somewhat newbie with a question. After searching Google and coming across 3 FTP backup scripts, I've managed to put together my own hybrid of all 3 of them. Essentially the script will do a full backup on Sundays, and incremental every other day. Then FTP the tar file to an FTP site.
I'm concerned about the incremental portion of this script. I have tried my
tar -g to do incremental backups, but since I am ftp'ing the tar files to a Windows machine (yikes), the tar -g results in an "invalid tar file", thus making it difficult to do a one-off file restore. So, I have found that for my setup, using
find works best.
Without pasting my entire script, here's a snippet of what I am having trouble with.
Code:
NOW=$(date +"%Y-%m-%d-%a")
DIRS="/var/www/html /etc"
LIST="/backup/inc-list.dat"
FILE="$NOW-incremental.tar.gz"
find $DIRS -depth \( -ctime -1 -o -mtime -1 \) -type f -print >> $LIST
tar -zcvf $BACKUP/$FILE -T $LIST
The find statement here works great for finding all files that were created or modified within the last day, and tarring the results in an incremental tar.
The problem I am having is that it's not capturing renamed folders. For example, if I have a folder containing some web scripts called
CURRENT. Typically when I perform an upgrade to the web scripts, I keep an archived copy as a backup. To archive I will rename the entire current folder to
OLD, then install the new scripts into a newly created folder called
CURRENT.
The issue I am having is that this newly renamed directory
OLD isn't being tracked up by the find statement since essentially no files ctime or mtime are changing.
I would like to capture the renamed folder in my incremental backups in case something happens and I need to revert back to the full backup and layer in the incrementals, the most recent changes are reflected.
Your thoughts? Or better yet, know of a better solution for incremental file and folder capture and backup?
Thanks for the help!