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



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

Reply via email to