From owner-freebsd-questions@FreeBSD.ORG Wed Nov 21 13:39:52 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67D1916A421 for ; Wed, 21 Nov 2007 13:39:52 +0000 (UTC) (envelope-from wodfer@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.191]) by mx1.freebsd.org (Postfix) with ESMTP id 3E71B13C461 for ; Wed, 21 Nov 2007 13:39:51 +0000 (UTC) (envelope-from wodfer@gmail.com) Received: by rv-out-0910.google.com with SMTP id l15so2101874rvb for ; Wed, 21 Nov 2007 05:39:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=lHPM5U/4e8S0u7BpzspXcpd5huPT2tkUn8t9mwtOwS4=; b=WkBncIk6TehFha+Lj5TWIC3OkQ7SIYnjHurtN+VOUCQAH5KN4IrO/r8mevuDMFbhoJJl/A4wvW6OKw1wjPZnlaxJi1HMdFc4Y6KeM3uzgWJvhCireYB8QJHCefRJgtsUMo8cPhBNOfww6kT2LPRFqFApbY+KjtnSw06Kd5BqWy0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=m6c7hq9b+6x/ZVsH7zHeQicRE5bkTBi0FWGHNFYrgEGoaHQqFWB8ZMhwkvMIdG1BBI9yLc5WciKoJMFHOZkDvOWvM9cz7e9S7F0V5aedldGM4xqZj5RgC9GJ2mYLR1SApu1qSQACbw4WYceR0BJYH2n9loILIQqOdzq6DVF+pGQ= Received: by 10.141.160.9 with SMTP id m9mr3305741rvo.1195652389502; Wed, 21 Nov 2007 05:39:49 -0800 (PST) Received: by 10.141.87.7 with HTTP; Wed, 21 Nov 2007 05:39:49 -0800 (PST) Message-ID: <23ed14b80711210539w4bed1enc180f8e32ec76881@mail.gmail.com> Date: Wed, 21 Nov 2007 14:39:49 +0100 From: "=?ISO-8859-1?Q?Andreas_Wider=F8e_Andersen?=" To: freebsd-questions MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Need help with backup shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2007 13:39:52 -0000 Hi, I'm working on a shell script that will let me attach (mount) an external USB 2.0 harddrive and to my FreeBSD 6.2 server and perform a full backup of /backup on my server (all files and subfolders) once or twice a week (whenever I run the cronjob). The script must be able to run through a cronjob and the drive must be mounted and unmounted after each job (I will swap between two drives of the same type and size). The script must also remove folders/files older than 30 days. Does anyone use a script like this today that they can share? I'm not a shell scripter myself so any help is highly appreciated. Here's my rough idea/sketch: #! /bin/sh $MOUNT = /external $DATE= date_today mount usb_drive $MOUNT cd /$MOUNT rm all files forlders older than 30 days mkdir /$DATE cp -fr /backup to /$MOUNT/$DATE cd unmount Thanks for your help! Best regards, Andreas