[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Scripting backups to cdrom.



And Lo! The Great Prophet " Chris J" uttered these words of wisdom:
>
> Something like this gives the basis to start from:
>
>         du -sk * | sort -k2 | mklist.awk
>

I've done some more fiddling and come up with:

#!/bin/awk -f
BEGIN {
        LIMIT=680000

        CDCOUNT=1
        SIZE=0
        PATHS=""
}
{
        if (SIZE + $1 > LIMIT) {
                SIZE = 0
                print "mkisofs -JraT -o CDROM" CDCOUNT ".iso " PATHS
                PATHS = ""
                CDCOUNT++
        }
        SIZE += $1
        PATHS = PATHS " " $2
}
## End of awk

This will print out the mkisofs command to create each ISO. It's up to you
to then run each one manually or end up doing:

        du -sk * | sort -k2 | mklist.awk > createisos.sh
        sh createisos.sh

if you do this, make sure you've got enough disk space :-)

Caution! Untested. It shouldn't break anything but use at own risk :)

You could even end up adding:

        print "cdrecord -v dev=..."

type line just after the print "mkisofs" line to have output that you can
plonk in a script and just run to burn the CDs... or change "print" to a
call to system, so instead of outputing the lines, it executes them there
and then...

Chris...

-- 
\ Chris Johnson                 \
 \ cej [at] nightwolf.org.uk          \
  \ http://cej.nightwolf.org.uk/  ~-----------------------------------+
   \ Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000 \____

___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.