On Monday 02 Jun 2003 7:29 am, Ray Warren wrote:
> On Sun, Jun 01, 2003 at 08:29:26PM +0100, Anne Wilson wrote:
> > I want to set up an additional task in the daily cron.  The
> > script I wrote is
> >
> > mv -fu /Data/Backup/GnomeCard.vcf /Data/Backup/GnomeCard.vcf.bak
>
> after this step /Data/Backup/GnomeCard.vcf no longer exists if it
> has been modified more recently than .bak
>
> > cp -fpu /home/anne/GnomeCard.vcf /Data/Backup/GnomeCard.vcf
>
> If step one was true then the copy will be made as the target file
> does not exist
>
> > By my understanding the -u flag says 'only if it is a later
> > version'.
>
> for later version substitute more recent modification date.
>
> It looks like the flow for this script is:
> working file = /home/anne/
> backup = /Data/Backup
> archive = .bak
>
> 1: change working file
> 2A: script runs: backup and archive have the same modification date
> no change
> 2B: working file is modified more recently than backup so copy
> working file to backup 3A: next time script runs: backup has been
> modified more recently than archive so move backup to archive
> 3B: since backup no longer exists the working file is again more
> recent so copy working file to backup even if working file has not
> changed.
>
> So once all of the files exist, the script has to run twice for
> each change before copies are no longer made.
>
> Ray Warren

Thanks for replying, Ray.  Actually, someone asked me a question 
off-list.  Since I had to spell out the logic for him, it dawned on 
my what was happening.  I left the script alone to see what would 
happen, and it ran overnight as intended.  I have a backup of last 
evening's changes, with an archive copy of earlier in the day, when 
the script first was run.

It has been suggested that rsync would be more efficient, so I will 
probably make changes, but I'm happy now that I can achieve the 
intended.  I feel much safer.

Anne

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to