[svlug] How do I write my backup script?

dfox@belvdere.vip.best.com dfox at belvdere.vip.best.com
Sat Jun 24 18:35:15 PDT 2000


> don't have a clue how to write the program to do the
> backup.

Lots of this stuff can be prototyped in shell. You can
look at the man pages for the things you need, i.e., you
need for instance to make a directory named with the
current date. man date can help you decide on what
arguments are appropriate.

> 1)create a new folder of the date (~/000624 for June
> 24, 2000)

mkdir `date +%Y%b%d`. This will make a directory that's
similar in format to '2000Jun24'. Other parameters will
give you different results. This is pretty good enough, and
unique enough.

> 2)copy all the files with the newest versions to the
> new folder.

Well, this is probably simple too. One possible approach would
be to have a version file, and increment the number in this
file once every time you run your backup script. Then, use the
contents of this file in the 'cp' as follows:

# copy latest version of file
cp datafile.whatever.`cat LATEST` $dest

> 3)purge all the files with old versions and only leave
> the newest versions in my NT machine.

Change the above cp to an 'mv', which will move the current version
file into the destination directory, and then rm everything else. That's
simpler, IMHO.

> 4)if possible, I'd like to backup to another NT
> server.

Easily doable with samba. Just mount the NT partition at a
convenient place, and send the file over. Then you can use whatever
NT software you normally use to make the backups.

> Sean Cheng
------------------------------------------------------------------------
David E. Fox                     Census         Thanks for letting me
dfox at belvdere.vip.best.com        2000          change magnetic patterns
Be Counted: http://www.census.gov               on your hard disk.
-----------------------------------------------------------------------




More information about the svlug mailing list