Date: Thu, 11 Nov 2004 13:11:55 -0500 From: Anish Mistry <mistry.7@osu.edu> To: Odhiambo Washington <wash@wananchi.com> Cc: freebsd-questions@freebsd.org Subject: Re: Nightly backup using CD-ROM - how do i? Message-ID: <200411111312.11301.mistry.7@osu.edu> In-Reply-To: <20041111164524.GA96388@ns2.wananchi.com> References: <20041109133932.GB41233@ns2.wananchi.com> <200411091923.30281.mistry.7@osu.edu> <20041111164524.GA96388@ns2.wananchi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2919069.4yIbZ8gUqv Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 11 November 2004 11:45 am, you wrote: > * Anish Mistry <mistry.7@osu.edu> [20041110 03:21]: wrote: > > [snip] > > Hey Anish, > > Thank you so much for your script. > > I am not quite a newbie on Unix, but your script has gotten me lost, > such that I feel like a newbie ;) > > Could you kindly explain to me, step-by-step, how it works, please? > > > #!/bin/sh > > # the date > > DATESTRING=3D`date +"%Y%m%d"` > > BACKUP_DIR=3D/usr/local/var/backup > > CD_DEVICE=3D/dev/acd0c > > Defining the date of the backups to copy, it assumes the current. Set the= =20 directory where the already tar'ed files are locations, and also set the=20 CDROM device. > > # first check if there is enough space left on device > > # mount > > #/sbin/mount /cdrom > > #CD_SIZE=3D700 > > #CD_FILL=3D`/usr/bin/du /cdrom | /usr/bin/cut -f 1` > > # unmount > > #/sbin/umount /cdrom > > This is just commented out since it I ended up no needing it. > > cd $BACKUP_DIR > > # get previous multisession info > > MSINFO=3D`/usr/sbin/burncd -f $CD_DEVICE msinfo` > > if [ "$MSINFO" !=3D "" ] > > then > > MULTISESSION=3D"-C $MSINFO -M $CD_DEVICE" > > else > > echo "First session." > > fi Here we probe the CD to get the last session's track info. If there is not= =20 last session info, then that means that it's a blank cd so we don't add=20 the multisession info to the mkisofs command. > > # create the .iso > > echo "Creating backup ISO..." > > /usr/local/bin/mkisofs -r -J -quiet $MULTISESSION -o > > $BACKUP_DIR/$DATESTRING.iso $BACKUP_DIR/$DATESTRING*.tar.gz # burn > > backups to cd We create an ISO offset with multisession info if available with the files= =20 in the backup directory that match the date string. > > echo "Burning backups to $CD_DEVICE..." > > /usr/sbin/burncd -f $CD_DEVICE -q -s 24 -m data > > $BACKUP_DIR/$DATESTRING.iso fixate if [ $? -ne 0 ] > > then > > echo "Sysadmin, I\'m sorry the backup failed." | /usr/bin/mail -s > > "The sky is falling!" someemail@fake.com fi We burn the iso to the CD, it the command returns non-zero then it goes=20 into the if statement and sends off and email tell someone to change the=20 CD. > > # delete the .iso > > echo "Deleting ISO..." > > rm $BACKUP_DIR/$DATESTRING.iso > > echo "Done." > > exit 0 Cleanup and exit. Hope that helps. =2D-=20 Anish Mistry --nextPart2919069.4yIbZ8gUqv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQBBk6t7xqA5ziudZT0RAvA2AKC1/4UbEb1V0x/uWE6eeB+jyXgCGQCgskIT hSzk/BtNBcTKLbkmBYSzH7s= =1fJI -----END PGP SIGNATURE----- --nextPart2919069.4yIbZ8gUqv--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411111312.11301.mistry.7>