Scripting backup of file naming?

Bart Silverstrim bsilver at chrononomicon.com
Mon Jun 7 08:02:06 PDT 2004


Hello scripting gurus..

I'm sure this is an easy one for someone out there.  Here's what I'd 
like to do, and hoping someone out there knows a simple way to do this 
without ripping my hair out.  Scenario:

*Two servers, Server1 and Server2.

*I want Server1 to copy a set of files from Server2 on a regular basis 
using cron and scp.  I should be able to do that by just generating a 
ssh key and automating the login from Server1 into Server2.

*problem; on server1, I'm going to have two directories: ~/archive and 
~/workingdir.  I want the scp to move the files from server2 to 
~/workingdir, tar and zip them as a file name with a date attached 
(like backup06072004.tgz) to make the filename distinctive, then move 
that file from ~/workingdir to ~/archive.  The filename would need to 
be distinctive both to allow for reference when needing to restore a 
snapshot and also to keep the archives from overwriting each other when 
moved over.

Is there a simple way to do this with a script running from cron?

-Bart



More information about the freebsd-questions mailing list