Imported Upstream version 0.4b37
[debian/dump] / examples / dump_on_remote_cd / get-dumpdata-to-cdrecord
1 #!/bin/bash
2 #ident "@(#) get-dumpdata-to-cdrecord Time-stamp: <02/05/06 13:49:28 bav> "
3 #******************************************************************
4 # get-dumpdata-to-cdrecord
5 #******************************************************************
6 #                              Gerd Bavendiek bav@epost.de 02-05-02
7 #
8 # This script runs on the box which has the CD-Burner. It starts an
9 # rsh on the box where dump is started and feeds the data to
10 # cdrecord. You should have copied it to
11 # PATH_TO_GET_DUMPDATA_TO_CDRECORD, see script dump-to-remote-cd.
12
13 # You definitely may wish to customize the cdrecords arguments below !
14 #
15 # If rsh is not appropiate for you, change to ssh.
16 #------------------------------------------------------------------
17
18 CDRECORD_TESTMODE=""             # This means: burn !
19 ###CDRECORD_TESTMODE="-dummy"       # and this: not really ...
20 CDRECORD_DEVICE="1,0"            # Run cdrecord --scanbus if in doubt
21 CDRECORD_SPEED=2                 # Speed of your burner
22 CDRECORD_BUFFERSIZE=16m          # Buffersize in MByte
23
24 #------------------------------------------------------------------
25 Usage()
26 {
27    echo >&2 "Usage: `basename $0` -d <dump_host> -f <fifo_name>"
28    exit 1
29 }
30
31 CDRECORD_ARGLIST="-v $CDRECORD_TESTMODE dev=$CDRECORD_DEVICE speed=$CDRECORD_SPEED fs=$CDRECORD_BUFFERSIZE"
32
33 while getopts "d:f:h" c; do
34   case $c in
35    d) # the dump host
36       DUMP_HOST=$OPTARG
37       ;;
38    f) # name of the fifo cdrecord has to read the data from
39       FIFO_NAME=$OPTARG
40       ;;
41    h) # help those who ask for help
42       Usage
43       ;;
44    '?') # any other switch
45       Usage
46       ;;
47   esac
48 done
49
50 if [ -z "$DUMP_HOST" -o -z "$FIFO_NAME" ]; then Usage; fi
51
52 rsh $DUMP_HOST dd if=$FIFO_NAME | cdrecord $CDRECORD_ARGLIST -eject -pad -data -
53 if [ $? -ne 0 ]; then
54    echo $0: `date '+%T'`: ERROR: Check cdrecords messages
55    exit 1
56 fi
57
58 # Local Variables:
59 # rcpbuf-todo: ("/[root@kiki]/root/tools")
60 # End: