On Wed, Jun 09, 2004 at 10:29:27AM -0400, Karen Donathan wrote:

>      What is the best way to back up the html directory?  We do not have a
> tape drive.  Is there a way to have an automated .tar file created and
> sent as email so I could save it on another server?  Any help would be
> great!

Yeah.  This sort of thing is easy to do with a very small shell
script.  From your specifications, something like this will do the


    PATH=/bin:/usr/bin ; export PATH

    recipient="[EMAIL PROTECTED]"
    today=$(date +%Y%m%d)

    tar -cvjf - ${htmldir} | uuencode backup-${today}.tar.bz2 | \
        mail -s "Backup of ${htmldir} on ${today}" ${recipient} \
        >>/var/log/backup.log 2>&1

Save that to a file, make it executable and run it out of root's
crontab on a daily basis:

    @daily /usr/local/bin/mybackupscript

(be sure you understand the difference between /etc/crontab and
/var/cron/tabs/root, and how to use crontab(1) correctly: do *not*
feed /etc/crontab into the crontab command.)

The recipient should use procmail or similar to feed the backup
messages into uudecode and so extract the compressed tar file.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Attachment: pgpXU3B2hUKU9.pgp
Description: PGP signature

Reply via email to