rssrik
2008-May-05 12:41 UTC
taking advantage of filles in folder other than destination folder
Dear Folks, I have to backup pgsql database dump everynight on a routine. The database dump actually contains sql(text) statements. The actual size of the database dump is aroung 800 MB. Between two days backup, only few lines of statements are modified/added/deleted. I dont want to do incremental backup. Instead, I want everyday's full dump to be stored on to a folder named DD-MM-YY(ex: 01-05-08). Everyday there will be a folder created with name DD-MM-YY and the dump will be stored there. Since the difference between the two day's backup are pretty minimal, I dont want to resend the 800 MB files everyday. Suppose, 1. I have taken yesterdays dump in a folder named 04-05-08 in database server 2. I have rsynced the folder 04-05-08 to the backup server. 3. I have taken today's dump in folder named 05-05-08 in database server. 4. Now while doing rsync, I want rsync to compare the <database server's 05-05-08/dump file> with the <04-05-08/dump file> which already exists in backup server. (then eventually, I want rsync to send only the differences and store the output in folder 05-05-08). Typicaly I want to take advantage of yesterday's file which already present in a different folder. Can anyone suggest a working method to implement this ? (I tried --copy-dest / --compare-dest .. but couldnt get it to work) Any response in this regard is most appreciated. Regards, rssrik -- View this message in context: http://www.nabble.com/taking-advantage-of-filles-in-folder-other-than-destination-folder-tp17060808p17060808.html Sent from the Samba - rsync mailing list archive at Nabble.com.
Paul Slootman
2008-May-05 13:13 UTC
taking advantage of filles in folder other than destination folder
On Mon 05 May 2008, rssrik wrote:> Suppose, > > 1. I have taken yesterdays dump in a folder named 04-05-08 in database > server > 2. I have rsynced the folder 04-05-08 to the backup server. > 3. I have taken today's dump in folder named 05-05-08 in database server. > 4. Now while doing rsync, I want rsync to compare the <database server's > 05-05-08/dump file> with the <04-05-08/dump file> which already exists in > backup server. (then eventually, I want rsync to send only the differences > and store the output in folder 05-05-08). > > Typicaly I want to take advantage of yesterday's file which already present > in a different folder. > > Can anyone suggest a working method to implement this ? (I tried --copy-dest > / --compare-dest .. but couldnt get it to work)Something like this should work... BASE=/backup/psql # edit for your situation REMOTESOURCE=dbhost::psqldumps/ # again, edit TODAY=`date +%d-%m-%y` # I prefer %Y-%m-%d, sorts better cd $BASE YESTERDAYS_BACKUP=`ls -td ??-??-?? | head -n 1` rsync -a --compare-dest=../$YESTERDAYS_BACKUP $REMOTESOURCE $TODAY/ Paul Slootman