Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jun 2004 16:05:53 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Karen Donathan <donathan@gwhs.kana.k12.wv.us>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Backup question
Message-ID:  <20040609150553.GA81647@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <20040609102723.H167@gwhs.kana.k12.wv.us>
References:  <20040609102723.H167@gwhs.kana.k12.wv.us>

next in thread | previous in thread | raw e-mail | index | archive | help

--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
job:

    #!/bin/sh

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

    htmldir=3D/usr/local/www/data
    recipient=3D"somebody@example.com"
    today=3D$(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.

	Cheers,

	Matthew

--=20
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

--opJtzjQTFsWo+cga
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAxydRiD657aJF7eIRAgrGAJ9+SBO8uyFHlmnWvbsEpf5QMFXbSACgr3HY
mOD59rNSyZFkFl4fQK795kQ=
=fRsv
-----END PGP SIGNATURE-----

--opJtzjQTFsWo+cga--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040609150553.GA81647>