2 #ident "@(#) dump-to-remote-cd Time-stamp: <02/05/06 15:12:29 bav> "
3 #******************************************************************
5 #******************************************************************
6 # Gerd Bavendiek bav@epost.de 02-05-02
8 # Script used to dump to a remote box with a CD-Burner. There is a
9 # companion script called get-dumpdata-to-cdrecord.
11 # Usage: dump-to-remote-cd [ -c <CD_capacity> ] [files to dump ...]
13 # If called without arguments, it will dump / assuming 650 MB Media on
14 # host kiki (see DEFAULT_ below).
16 # You must be able to do an rsh as root to BURN_HOST and vice versa,
17 # see get-dumpdata-to-cdrecord. You may use ssh instead.
18 #------------------------------------------------------------------
20 #--- Customize to fit your needs ----------------------------------
22 PATH_TO_GET_DUMPDATA_TO_CDRECORD=/root/tools/get-dumpdata-to-cdrecord
23 PATH_TO_XTERM=/usr/X11R6/bin/xterm
25 FIFO_NAME=/tmp/get-dumpdata-to-cdrecord.fifo
29 DEFAULT_CD_CAPACITY=650
32 #--- End of customizing -------------------------------------------
37 echo >&2 "Usage: `basename $0` [ -c <CD_capacity> ] [files to dump ...]"
41 if [ `id -u` != 0 ]; then
42 echo "$0: ERROR: root priviledges are required ..."
46 # Check whether first argument is a named pipe
48 # We are called internally either from ourselves or from dump
51 tput bel;sleep 1; tput bel
52 echo "Insert next CD (number $num) ..."
53 read -p "CD number $num ready ? " Ans
56 $PATH_TO_XTERM -hold -T "Dump_CD_number_$num" -cr red -fn 6x10 -e \
57 $PATH_TO_GET_DUMPDATA_TO_CDRECORD -d $DUMP_HOST -f $FIFO_NAME &
61 CD_CAPACITY=$DEFAULT_CD_CAPACITY
64 # We will reach this code only when not called internally
65 while getopts "b:c:h" c; do
70 h) # help those who ask for help
73 '?') # any other switch
79 shift `expr $OPTIND - 1`
81 if [ -n "$*" ]; then FS="$*"; fi
83 DumpLevel=0 # level 0 dump
84 Label=`date -I` # Take today's date as label, e.g. 2002-05-02
86 eval Capacity=$(($CD_CAPACITY*1024))
88 # Remove the fifo on the server and make a new one
89 rm -f $FIFO_NAME; mkfifo $FIFO_NAME
91 # Call user exit for the very first time, all further calls will be
93 $USER_EXIT $FIFO_NAME 0
97 dump -z -B$Capacity -F $USER_EXIT -$DumpLevel -L $Label -f $FIFO_NAME $FS