From owner-freebsd-questions Tue Jul 23 21:12:28 2002 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 7719C37B400 for ; Tue, 23 Jul 2002 21:12:17 -0700 (PDT) Received: from cyberlord.net.dhis.org (ip68-14-182-106.pn.at.cox.net [68.14.182.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66DA943E6A for ; Tue, 23 Jul 2002 21:11:53 -0700 (PDT) (envelope-from cyberlord@cyberlord.net.dhis.org) Received: from cyberlord.net.dhis.org (localhost.cyberlord.net.dhis.org [127.0.0.1]) by cyberlord.net.dhis.org (8.12.3/8.12.3) with ESMTP id g6O3m3MU074017; Tue, 23 Jul 2002 22:48:03 -0500 (CDT) (envelope-from cyberlord@cyberlord.net.dhis.org) Received: by cyberlord.net.dhis.org (8.12.3/8.12.3/Submit) id g6O3m1kH074016; Tue, 23 Jul 2002 22:48:01 -0500 (CDT) Content-Type: text/plain; charset="iso-8859-1" From: Tim To: Michelle Weeks , freebsd-questions@FreeBSD.ORG Subject: Re: Backup Scripts Date: Tue, 23 Jul 2002 22:48:00 -0500 X-Mailer: KMail [version 1.4] References: <7947A24A-9EB7-11D6-BE51-00039368B8EC@mindspring.com> In-Reply-To: <7947A24A-9EB7-11D6-BE51-00039368B8EC@mindspring.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200207232248.00898.cyberlord@cyberlord.net.dhis.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Do you have #!/bin/sh as the first line in all your scripts? and are they in a directory in your path? If they are not, you must run t= hem=20 as follows:=20 =2E/script_name Hope this helps, Tim On Tuesday 23 July 2002 10:43 pm, Michelle Weeks wrote: > I am new to scripting and am trying to use the below script I found to > run backups of our FreeBSD 4.5 server, but I keep getting the error: > > Level-backup.sh Backup Tue Jul 23 21:04:22 PDT 2002 > Error: Level-backup.sh unknown > > Since I am new at this, I am probably missing something very obvious. = I > would greatly appreciate any help or advice as to where I can find more > info. on creating backup scripts for FreeBSD. > > > Here is the script I am using: > > > # Variables > EMAILTO=3Dbackup > DESTFILE=3D/dev/nrsa0 > BACKUPFILES=3D"/var /usr/home" > BACKUPDIR=3D${HOME}/backup > LEVEL=3D${0} > > # Load backup functions > cd ${BACKUPDIR} > . backup-functions > > # Do the backup > tar_backup > > # Test the backup for errors > tar_verify > > # Email the backup report > mail_report > > # Done > exit > > and here is the .backup-functions file for the shell script: > > # Variables > L0DATESTAMP=3D"${BACKUPDIR}/.level0_datestamp" > NOW=3D`date` > > # tar_backup function: does the archiving > tar_backup () > { > echo "Level-${LEVEL} Backup ${NOW}" > if [ "${LEVEL}" =3D "0" ]; then > # make Level-0 datestamp > echo ${NOW} > ${L0DATESTAMP} > # Level-0 backup > tar --create --verbose \ > --file ${DESTFILE} \ > --blocking-factor 126 \ > --label "Level-${LEVEL} Backup ${NOW}" \ > ${BACKUPFILES} > elif [ "${LEVEL}" =3D "1" ]; then > # get last Level-0 datestamp > LAST=3D`cat ${L0DATESTAMP}` > # Level-1 backup > tar --create --verbose \ > --file ${DESTFILE} \ > --blocking-factor 126 \ > --after-date "${LAST}" \ > --label "Level-${LEVEL} Backup from ${LAST} to ${NOW}" \ > ${BACKUPFILES} > else > # Backup level error > echo "Error: Level-${LEVEL} unknown" > exit > fi > echo "Level-${LEVEL} Backup END" > } > > # tar_verify function: test the archive for errors > tar_verify () > { > echo "Level-${LEVEL} Backup Verify ${NOW}" > # Backup verify test > tar --list --verbose \ > --file ${DESTFILE} \ > --blocking-factor 126 > echo "Level-${LEVEL} Backup Verify END" > } > > # mail_report function: sends backup report > mail_report () > { > # Email backup report > mail -s "Level-${LEVEL} Backup" "${EMAILTO}" << EOF > > ########################################################### > Level-${LEVEL} Backup > ########################################################### > > Host: ${HOSTNAME} > Files: ${BACKUPFILES} > > Destination: ${DESTFILE} > > ########################################################### > Started: ${NOW} > Completed: `date` > ########################################################### > > EOF > } > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message --=20 FreeBSD 4.6-RELEASE 10:44PM up 16:04, 1 user, load averages: 0.00, 0.05, 0.08 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message