D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Moving files remotely

 

On 24/08/11 17:03, Gibbs wrote:
> 
> My aim is to move all email files to another server that has more disk
> space (daily or weekly). I tried doing this in rsync with a few
> arguments such as --delete and --remove-sent-files but it produced some
> odd results, sometimes with both the source/destination files getting
> deleted. 

--remove-source-files and using "--dry-run" (-n) to test the settings
are as you want.

You don't want any deletes since you aren't synchronising.

Yes rsync will do it, and these days it is likely to be using ssh by
default so fairly easy to do in a secure manner.

You could use other tools (scp) but you'd have to script the removal
which makes it harder.

Other point is a security one, I would try to do this as a "PULL"
action. i.e. Run the RSYNC from the archiving box (something like rsync
-avn --remove-source-files
mailuser@mailserver:/var/spool/mail/alwaysbcc/ /var/archive) - the
argument being the archiving box can be made more secure than a mail
server can, and you would need to trust the client machine from the
server. If you push it, the archiving server has to trust the less
secure email server.

I've never used "remove-source-files" routinely and never with a pull
but I expect rsync does the right thing.

I've accidentally used rsync without --delete before so I know it does
what you want. Also set a timeout on rsync, as it can hang, and you want
to know when the cronjob has failed rather than it hanging around till
you do a "ps -ef", especially if you set it to run silently when it
works. Or you may want to have it send and email anyway - and cross it
off on your checklist - depends how crucial it is.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq