Need to understand exactly what the "--delete" flag does when rsync runs. Here is my understanding... If a file is created on the source machine on monday, then rsync'd to the rsync server on monday night, then deleted on the source machine tuesday, then it will be deleted from the rsync server on tuesday night when the cron job runs again. But, would rsync under any circumstances, ever delete files on the source machine? My log showed a bunch of these statements, and to be quite honest, scared the living daylights out of me. (from LOG) deleting peachbackups/peachw/Peachtree Archive Data Files/archivec/W200001.FRM deleting peachbackups/peachw/Peachtree Archive Data Files/archivec/W200000.FRM ......... I am using the script from rsync.org the for 7-day incremental backups written by tridge. Here is the part I am not sure what it does... # the following line clears the last weeks incremental directory [ -d $HOME/emptydir ] || mkdir $HOME/emptydir rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/ rmdir $HOME/emptydir Thanks for any pointers on this. -Jeff
On Wednesday 23 Nov 2005 04:08, Jeff Martin wrote:> Need to understand exactly what the "--delete" flag > does when rsync runs. > > Here is my understanding... If a file is created on > the source machine on monday, then rsync'd to the > rsync server on monday night, then deleted on the > source machine tuesday, then it will be deleted from > the rsync server on tuesday night when the cron job > runs again. > But, would rsync under any circumstances, ever delete > files on the source machine?I don't think so. I use --delete all the time on my backups to make the backup directory match exactly the source directory. If I want to save any files on the backup directory that will get deleted by such an operation I also add --backup --backup-dir=XXXX (where XXXX is somewhere useful)> > My log showed a bunch of these statements, and to be > quite honest, scared the living daylights out of me. > > (from LOG) > deleting peachbackups/peachw/Peachtree Archive Data > Files/archivec/W200001.FRM > deleting peachbackups/peachw/Peachtree Archive Data > Files/archivec/W200000.FRM > .........Thats deleteing data from the backup directory - so that it matches what's in your source directory. Isn't that what you want?> > > I am using the script from rsync.org the for 7-day > incremental backups written by tridge. > > Here is the part I am not sure what it does... > # the following line clears the last weeks incremental > directory > [ -d $HOME/emptydir ] || mkdir $HOME/emptydir > rsync --delete -a $HOME/emptydir/ > $BSERVER::$USER/$BACKUPDIR/ > rmdir $HOME/emptydir >That is just a technique for clearing out a directory on a machine that you connect to via rysncd. Create an empty directory on you local machine, and then rsync --delete this directory to the remote machine, and it makes the remote directoy empty. -- Alan Chandler http://www.chandlerfamily.org.uk Open Source. It's the difference between trust and antitrust.
On Tue, Nov 22, 2005 at 08:08:56PM -0800, Jeff Martin wrote:> Need to understand exactly what the "--delete" flag does when rsync > runs.I think the rsync manpage explains this quite well: This tells rsync to delete extraneous files from the receiving side (ones that aren't on the sending side), but only for the directories that are being synchronized. You must have asked rsync to send the whole directory (e.g. "dir" or "dir/") without using a wildcard for the directory's contents (e.g. "dir/*") since the wildcard is expanded by the shell and rsync thus gets a request to transfer individual files, not the files' parent directory.> But, would rsync under any circumstances, ever delete files on the > source machine?If --remove-sent-files was used and if the source machine wasn't marked as read-only, and if the --remove-sent-files option (or --delete in general) wasn't configured to be refused by the daemon, that is the only time that files on the sending side would be removed.> rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/Since you're sending files *to* the daemon, it's entirely appropriate for it to be logging which files were locally deleted (since the daemon is the receiving side). If you were pulling files from an rsync daemon, the logs would not contain messages about what the client (receiver) was deleting. ..wayne..