[wplug] Re: CD Burner Program

Kramer-James at MSHA.gov Kramer-James at MSHA.gov
Fri Nov 29 15:50:44 EST 2002



-----Original Message-----
From: Robert Supansic [mailto:rsupansic at libcom.com]
Sent: Wednesday, November 27, 2002 10:58 AM
To: wplug at wplug.org
Subject: [wplug] Re: CD Burner Program


>From: "Wise, Jeremey" <WISEJ at PIOS.com>
>To: "'wplug at wplug.org'" <wplug at wplug.org>
>Date: Tue, 26 Nov 2002 08:05:00 -0500
>Subject: [wplug] CD Burner Program
>Reply-To: wplug at wplug.org
>
>Intro: My name is Jeremey Wise I live in Sunny Cleveland Ohio. I work for a
>large company who focuses on enterprise system designs. As one of my
product
>repertoires I work with Linux. To keep my Linux skills up I help out a
small
>"mom and pop" company out with their systems. I have build a s
>The problem is I am missing some important pieces of logic in my script. I
>have tried to document the process flow so you can follow my reasoning but
I
>do not know how to fill in the 'magic' pieces.
>
>#!/bin/bash
># CD Backup Script
># By Jeremey Wise 11-5-02
># Version 0.3
># This script should be located in /mnt/backup
># This script assumes you are root level, have tar and space in /mnt for
>backups cd /mnt/backup # Gettomg the backup directory structure created by
>the date so it is easily tracked echo Making Backup Directory Coresponding
>to Date mkdir /mnt/backup(date +%Y-%m-%d) cd /mnt/backup/(date +%Y-%m-%d)
>echo date (date +%Y-%m-%d)>/mnt/backup/(date +%Y-%m-%d)/Backup.log
>
># Make a backup of the boot partition including MBR because it is small and
>important echo Generating Boot Partition Backup >/mnt/backup/(date
>+%Y-%m-%d)/Backup.log dd if=/dev/mda1 of=/mnt/backup/(date 
>+%Y-%m-%d)/BootPartition.img
>
># Build a listing of all files with their path to be backed up echo
>Generating MasterFileBackup List find /home /var/log >/mnt/backup/(date
>+%Y-%m-%d)/masterfilelist
>
># Set counter to track which CD number is being generated COUNTER=0
>
># Start the process of building the CD archive by checking if their is
>anything needing backup if [ls -s /mnt/backup/(date
>+%Y-%m-%d)/masterfilelist |grep ='  0'] ;
>        then ($COUNTER+=1) ;
>
>#Magic happens here to insure 2 things - that the backup in progress does
>not exceed 650MB and/or the master file list is no zero line (i.e. backup
>complete)
>	if [ls -sh /mnt/backup/tmp|grep <= 650M] ; or [ls -sh
>/mnt/backup/(date +%Y-%m-%d)/masterfilelist|grep ='  0'] ;
>
>#Magic below to generate a file that catalogs those files compressed and
>added to current archive in tmp dir, while prepping master file list for
>next parse by removing top line (file just processed)
>	then (yank first line in masterfilelist & fork one copy into TOC
>file & one to set $file) |gzip -9cf '/mnt/backup/tmp/'$file'.gz ;
>
>fi ; 
>
>
># Now that we have reached 650MB or are done with the backup we will
>generate the ISO image and prompt the user to insert media echo "Starting
>ISO Compiled Fullbackup_'$COUNTER'.iso" >/mnt/backup/(date
>+%Y-%m-%d)/Backup.log ; mkisofs -r -l -o /mnt/backup/(date 
>+%Y-%m-%d)/Fullbackup_'$COUNTER'.iso /mnt/backup/(date +%Y-%m-%d)/tmp
>/mnt/backup/(date +%Y-%m-%d)/Backup.log echo "ISO Compiled
>Fullbackup_'$COUNTER'.iso" >/mnt/backup/(date +%Y-%m-%d)/Backup.log
>
># Remove temp directory so we can procesd in generating the next CD if
>needed echo "Returning for Next CD Build>/mnt/backup/(date
>+%Y-%m-%d)/Backup.log
>rm -rf /mnt/backup/tmp
>
>#Majic to return to counter line above and incriment counter
>
>
># Now that ALL the needed ISO images are created we wait for backup Manager
>to come into work so we can start promting them to change media for final
>burn. echo "Begining CD Burn Process" >/mnt/backup/(date
>+%Y-%m-%d)/Backup.log
>
># Below are various methods to get the user's attention. Pick one or many
>depending on how anoying you wish to be. echo "Please Insert Blank CD into
>drive and Press <F10>on Server the Keyboard" |mail -s "Backup Request"
>BackupMGR at Acme.com  
>echo "Please Insert Blank CD into drive and Press <F10>on Server the
>Keyboard" |smbclient -M Station1
>
># Majic here for user to press a key on the keyboard and have it continue
>with this script. if [User pressed <F10> on server keyboard] & '$COUNTER'
>>0] ;
>        then
>	cdrecord -speed=8 -dev=0,1,0 -eject -dao -pad -padsize=150s
>/mnt/backup/(date +%Y-%m-%d)/Fullbackup_'$COUNTER'.iso ;
>	($COUNTER-=1)
>	else 
>	# Last CD Burned So we can exit
>	echo "Backup Completeted Succesfully" >/mnt/backup/(date
>+%Y-%m-%d)/Backup.log
>	less /mnt/backup/(date +%Y-%m-%d)/Backup.log|mail -s "Backup
>Request" BackupMGR at Acme.com
>	echo "Backup Completeted Succesfully"|smbclient -M Station1
>	
>fi ;
>
># Prompt the user to lable the CD and insert a new blank
>echo "Please label ejected CD Fullbackup_'$COUNTER' & (date +%Y-%m-%d) then
>insert blank CD into drive and press <F10>on Server the Keyboard" |mail -s
>"Backup Request" BackupMGR at Acme.com  
>echo "Please label ejected CD (Fullbackup_'$COUNTER') & (date +%Y-%m-%d)
>then insert blank CD into drive and press <F10>on Server the Keyboard"
>|smbclient -M Station1
>
># All done
>
>If you wish to reply back to or have an idea of a portion of the script
>issues please feel free to modify and RSVP to me or the group and I will
try
>to compile the suggestions. I will of course supply everyone a copy of the
>final product as I believe we all support small windows / SMB environments
>where backups are an issue.
>
>Thanks,
>
>Jeremey Wise (440)-519-6006
>(CNE,MCSE,CSE)
>Pioneer-Standard Electronics, Inc
>wisej at pios.com
> 
>
>
>
>--__--__--
>
>_______________________________________________
>wplug mailing list
>wplug at wplug.org
>http://www.wplug.org/mailman/listinfo/wplug
>
>
>End of wplug Digest
>---
>[This E-mail scanned for viruses by Declude Virus]
>
>
>

Jeremy, funny you should ask.

At the November meeting of the Western Pennsylvania Linux Users Group
(WPLUG) I 
presented a deatiled discussion of the problem of backing up small networks.
I discussed 
the general design issues involved and presented several (short) scripts to
illustrate these 
issues and to afford people a jumping-off point for developing their own
scripts.

If you are interested in the scripts, contact me through my personal e-mail
address and I will 
send you the files. Feel free to use them as you see fit.

---
[This E-mail scanned for viruses by Declude Virus]



Robert,
Would you please send to me a copy of the backup scripts.  I am sorry that I
missed your lecture.  Thanks in advance.  I tried to mail you personal
e-mail[rsupansic at libcom.com] twice but was rejected.  Our email system
behaves strangely (Windows you know).

Jay

_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.wplug.org/pipermail/wplug/attachments/20021129/1954ec86/attachment-0001.html


More information about the wplug mailing list