LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Incremental backup script question (http://www.linuxquestions.org/questions/linux-software-2/incremental-backup-script-question-881451/)

drsprite 05-18-2011 01:17 PM

Incremental backup script question
 
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!

jothan sans cheer 05-18-2011 02:38 PM

Unfortunately I cannot answer your question directly, but I do have a handy tool in use. Its called unison and I use it mainly for synchronisation tasks. However it offers some backup capabilities as well and can operate on remote machines as well. Maybe the homepage can tell you if it's suitable for your purposes.

jothan.

drsprite 05-19-2011 02:08 PM

Thank you. I will look at this.

In the meantime, anyone else have any suggestions?


All times are GMT -5. The time now is 05:56 AM.