Followup on File backup question of Feb 4


Subject: Followup on File backup question of Feb 4
From: Bob Crosby (bob@estimations.com)
Date: Thu Feb 12 2004 - 15:41:45 AKST


Following up on my earlier question(s) about file backups, I ended up using
the following script that Dave posted. (Works great. Thanks!) I now have a
script that writes job files to a set of zipfiles on a backup drive, each
one sized to fit on a single CD. And, using the -u option, it is pretty
quick because it only has to update files that changed that day since the
last backup.

> > #!/bin/sh
> >BAKLSTDIR=/home/jobs/active-jobs/
> >BAKLST=/path/to/backup/BAKLST-temp
> >BAKDIR=/path/to/backup/
> >
> >cd ${BAKDIR}
> ># if ${BAKLST} exists then add the prefix 'old.' to it
> >[ -f ${BAKLST} ] && mv ${BAKLST} old.${BAKLST}
> >find ${BAKLSTDIR} | sed -e '1d' > ${BAKLST}
> >
> >for LETTER in ABCD EFGH IJKL MNOP QRST UVWX YZ
> >do
> > # grep returns 1 when it finds nothing matching the pattern
> > # given to it: 1 == false, ! false == true, true means the
> > # second bit of the expression is evaluated, and the empty file
> > # created by grep finding no lines is deleted
> > ! grep -i -e "^${BAKLSTDIR}[${LETTER}].*" ${BAKLST} >
> ${BAKLST}.${LETTER} && rm ${BAKLST}.${LETTER}
> >done

And here is one of the (multiple) lines following. I ended up using zip
instead of tar, because (apparently) you can't update gzipped tar files,
but only create new. (Or at least I couldn't get it to. Willing to be
corrected on that.).

zip -r -i@/mnt/backupdrive/jobs/BAKLST-temp.ABCD -u
/mnt/backupdrive/jobs/jobs_A-C /home/jobs/Active/

Here's another question: Could I use the variable names declared at the top
instead of spelling out the long pathnames in this command? I thrashed
around with it for a while, but couldn't figure out the syntax to get it to
work.

Also, I thought it would be cool to add another feature. Like send an email
to the office manager every night after completing the backups, with a list
of the backup files created. I've never used sendmail, but guess it would
be something like piping the results of a find command to sendmail, with
appropriate addresses & options, etc. Is this doable? (It would be sending
to an external account, not one served from this server.)

Advance thanks for any help.

Bob Crosby

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Thu Feb 12 2004 - 15:42:48 AKST