From: Stelian Pop Date: Fri, 17 May 2002 08:10:43 +0000 (+0000) Subject: Scripts to dump to a remote CD burner. X-Git-Tag: release_0_4b29~4 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5fb6554eaf09f19f4421fdb36e04a6b6de082fe9;p=dump.git Scripts to dump to a remote CD burner. --- diff --git a/CHANGES b/CHANGES index a02710c..0f1cedb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.175 2002/05/16 21:22:36 stelian Exp $ +$Id: CHANGES,v 1.176 2002/05/17 08:10:43 stelian Exp $ Changes between versions 0.4b28 and 0.4b29 (released ??????????????) ==================================================================== @@ -23,6 +23,10 @@ Changes between versions 0.4b28 and 0.4b29 (released ??????????????) of dump: http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32414 Thanks to Ted Grzesik for reporting the bug and help testing the patch. + +4. Added some example scripts from Gerd Bavendiek + which makes one able to pipe the output of dump, by the net, to + a remote CD-burner server. Changes between versions 0.4b27 and 0.4b28 (released April 12, 2002) ==================================================================== diff --git a/THANKS b/THANKS index c2dd136..cc4dde5 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.58 2002/05/16 21:22:36 stelian Exp $ +$Id: THANKS,v 1.59 2002/05/17 08:10:43 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -24,6 +24,7 @@ Eros Albertazzi eros@lamel.bo.cnr.it John Adams johna@onevista.com Andrea Arcangeli andrea@suse.de Stephen Atwell satwell@urbana.css.mot.com +Gerd Bavendiek bav@epost.de Stan Bubrouski satan@fastdial.net Stephen Carr sgcarr@civeng.adelaide.edu.au Rob Cermak cermak@ahab.rutgers.edu diff --git a/examples/dump_on_remote_cd/README b/examples/dump_on_remote_cd/README new file mode 100644 index 0000000..d07761d --- /dev/null +++ b/examples/dump_on_remote_cd/README @@ -0,0 +1,35 @@ +> I'll be more than happy to put a copy of your scripts in the dump +> distribution once you'll get this work :-) + +So you may have a look at the enclosed scripts. + +I use rsh in both directions. This may easily be changed to ssh. + +Basically three scripts are now necessary. The first wraps around the +dump-command, the second acts as user exit when CD has to be changed +and the third has to be run on the remote box. + +To make things easier I put the first two into one file called +dump-to-remote-cd. The second file called get-dumpdata-to-cdrecord must +be copied to the box with the CD-Burner. There is a small +configuration section in it to get cdrecord to work. + +dump-to-remote-cd may be called with the capacity of the media which +is used and / or a filesystem argument passed to dump. + +Usage is: + +dump-to-remote-cd [ -c ] [files to dump ...] + +There are defaults in the scripts which are used if any of these +arguments are missing. The hostname of the box with the CD-burner +has to be edited in any case. + +Kind regards + +Gerd + +------------------------------------------------------------------------ +Gerd Bavendiek Linux Laptop Users check out: +bav@epost.de http://netenv.sourceforge.net +------------------------------------------------------------------------ diff --git a/examples/dump_on_remote_cd/dump-to-remote-cd b/examples/dump_on_remote_cd/dump-to-remote-cd new file mode 100755 index 0000000..cefc321 --- /dev/null +++ b/examples/dump_on_remote_cd/dump-to-remote-cd @@ -0,0 +1,98 @@ +#!/bin/bash +#ident "@(#) dump-to-remote-cd Time-stamp: <02/05/06 15:12:29 bav> " +#****************************************************************** +# dump-to-remote-cd +#****************************************************************** +# Gerd Bavendiek bav@epost.de 02-05-02 +# +# Script used to dump to a remote box with a CD-Burner. There is a +# companion script called get-dumpdata-to-cdrecord. +# +# Usage: dump-to-remote-cd [ -c ] [files to dump ...] +# +# If called without arguments, it will dump / assuming 650 MB Media on +# host kiki (see DEFAULT_ below). +# +# You must be able to do an rsh as root to BURN_HOST and vice versa, +# see get-dumpdata-to-cdrecord. You may use ssh instead. +#------------------------------------------------------------------ + +#--- Customize to fit your needs ---------------------------------- + +PATH_TO_GET_DUMPDATA_TO_CDRECORD=/root/tools/get-dumpdata-to-cdrecord +PATH_TO_XTERM=/usr/X11R6/bin/xterm + +FIFO_NAME=/tmp/get-dumpdata-to-cdrecord.fifo + +BURN_HOST=kiki + +DEFAULT_CD_CAPACITY=650 +DEFAULT_FS=/ + +#--- End of customizing ------------------------------------------- + +USER_EXIT=$0 + +Usage(){ +echo >&2 "Usage: `basename $0` [ -c ] [files to dump ...]" + exit 1 +} + +if [ `id -u` != 0 ]; then + echo "$0: ERROR: root priviledges are required ..." + exit 1 +fi + +# Check whether first argument is a named pipe +if [ -p "$1" ]; then + # We are called internally either from ourselves or from dump + FIFO_NAME=$1 + num=$[$2+1] + tput bel;sleep 1; tput bel + echo "Insert next CD (number $num) ..." + read -p "CD number $num ready ? " Ans + DUMP_HOST=`uname -n` + rsh $BURN_HOST \ + $PATH_TO_XTERM -hold -T "Dump_CD_number_$num" -cr red -fn 6x10 -e \ + $PATH_TO_GET_DUMPDATA_TO_CDRECORD -d $DUMP_HOST -f $FIFO_NAME & + exit 0 +fi + +CD_CAPACITY=$DEFAULT_CD_CAPACITY +FS=$DEFAULT_FS + +# We will reach this code only when not called internally +while getopts "b:c:h" c; do + case $c in + c) # Media Capacity + CD_CAPACITY=$OPTARG + ;; + h) # help those who ask for help + Usage + ;; + '?') # any other switch + Usage + ;; + esac +done + +shift `expr $OPTIND - 1` + +if [ -n "$*" ]; then FS="$*"; fi + +DumpLevel=0 # level 0 dump +Label=`date -I` # Take today's date as label, e.g. 2002-05-02 + +eval Capacity=$(($CD_CAPACITY*1024)) + +# Remove the fifo on the server and make a new one +rm -f $FIFO_NAME; mkfifo $FIFO_NAME + +# Call user exit for the very first time, all further calls will be +# done via dump +$USER_EXIT $FIFO_NAME 0 +sleep 2 + +# Run dump +dump -z -B$Capacity -F $USER_EXIT -$DumpLevel -L $Label -f $FIFO_NAME $FS + diff --git a/examples/dump_on_remote_cd/get-dumpdata-to-cdrecord b/examples/dump_on_remote_cd/get-dumpdata-to-cdrecord new file mode 100755 index 0000000..ef7f226 --- /dev/null +++ b/examples/dump_on_remote_cd/get-dumpdata-to-cdrecord @@ -0,0 +1,60 @@ +#!/bin/bash +#ident "@(#) get-dumpdata-to-cdrecord Time-stamp: <02/05/06 13:49:28 bav> " +#****************************************************************** +# get-dumpdata-to-cdrecord +#****************************************************************** +# Gerd Bavendiek bav@epost.de 02-05-02 +# +# This script runs on the box which has the CD-Burner. It starts an +# rsh on the box where dump is started and feeds the data to +# cdrecord. You should have copied it to +# PATH_TO_GET_DUMPDATA_TO_CDRECORD, see script dump-to-remote-cd. +# +# You definitely may wish to customize the cdrecords arguments below ! +# +# If rsh is not appropiate for you, change to ssh. +#------------------------------------------------------------------ + +CDRECORD_TESTMODE="" # This means: burn ! +###CDRECORD_TESTMODE="-dummy" # and this: not really ... +CDRECORD_DEVICE="1,0" # Run cdrecord --scanbus if in doubt +CDRECORD_SPEED=2 # Speed of your burner +CDRECORD_BUFFERSIZE=16m # Buffersize in MByte + +#------------------------------------------------------------------ +Usage() +{ + echo >&2 "Usage: `basename $0` -d -f " + exit 1 +} + +CDRECORD_ARGLIST="-v $CDRECORD_TESTMODE dev=$CDRECORD_DEVICE speed=$CDRECORD_SPEED fs=$CDRECORD_BUFFERSIZE" + +while getopts "d:f:h" c; do + case $c in + d) # the dump host + DUMP_HOST=$OPTARG + ;; + f) # name of the fifo cdrecord has to read the data from + FIFO_NAME=$OPTARG + ;; + h) # help those who ask for help + Usage + ;; + '?') # any other switch + Usage + ;; + esac +done + +if [ -z "$DUMP_HOST" -o -z "$FIFO_NAME" ]; then Usage; fi + +rsh $DUMP_HOST dd if=$FIFO_NAME | cdrecord $CDRECORD_ARGLIST -eject -pad -data - +if [ $? -ne 0 ]; then + echo $0: `date '+%T'`: ERROR: Check cdrecords messages + exit 1 +fi + +# Local Variables: +# rcpbuf-todo: ("/[root@kiki]/root/tools") +# End: