From owner-freebsd-questions@FreeBSD.ORG Wed Jun 9 15:04:35 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EFDD16A4CE for ; Wed, 9 Jun 2004 15:04:35 +0000 (GMT) Received: from internet.potentialtech.com (h-66-167-251-6.phlapafg.covad.net [66.167.251.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 18AD543D45 for ; Wed, 9 Jun 2004 15:04:35 +0000 (GMT) (envelope-from wmoran@potentialtech.com) Received: from working.potentialtech.com (pa-plum1c-102.pit.adelphia.net [24.53.179.102]) by internet.potentialtech.com (Postfix) with ESMTP id 5B71B69A71; Wed, 9 Jun 2004 11:04:34 -0400 (EDT) Date: Wed, 9 Jun 2004 11:04:33 -0400 From: Bill Moran To: Karen Donathan Message-Id: <20040609110433.2827e926.wmoran@potentialtech.com> In-Reply-To: <20040609102723.H167@gwhs.kana.k12.wv.us> References: <20040609102723.H167@gwhs.kana.k12.wv.us> Organization: Potential Technologies X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-portbld-freebsd4.9) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-questions@FreeBSD.org Subject: Re: Backup question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 15:04:35 -0000 Karen Donathan wrote: > Hello. > > 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! Ah ... a neophyte unwittingly asking to be taught the magic of shell-scripting. Yes, you can do everything you ask. The trick is to write a shell script to automate it for you, then add the shell script to cron to be automagically executed on a schedule. Here's my suggestion: 1) Study the attached shell script, it backs up to a seperate HDD, but it'll give you an idea of how things work 2) Read up on "man mail" to learn how to use the mail program from a shell script 3) Write your own and test it from the command line. 4) Add a cron entry to automate it. 5) Once you're getting good backups, look into using rsync to make the process even smoother. #!/bin/sh # Takes the files in /backup/source and bzips them into an # archive in /backup/archive # Also deletes archive files older than a certain amount DATE=`/bin/date "+%F"` MAXAGE=14 /usr/bin/tar cyf /backup/archive/backup-${DATE}.tbz /backup/source > /dev/null 2>&1 /usr/bin/find /backup/archive -mtime ${MAXAGE} -delete -- Bill Moran Potential Technologies http://www.potentialtech.com