cdrecord scripting question.

Wayne Pinette Wpinette at cariboo.bc.ca
Fri Sep 3 15:29:36 UTC 2004


Howdy all, I have a sh/bash/csh scripting question regarding cdrecord


I have a system here who's owner wants to do daily backups to cd rw
cd's.  I wrote a script to do
this using cdrecord (make the iso file first, then burn it to cd) and
it works famously except for one
small and annoying problem.

I try to log everything I do and then print off the log.  Unfortunately
the output I get from
cdrecord is not actually going to the log file so there is no
information as whether the backup was
successful or not, which makes the printout pretty much useless.

The script is as follows : 


#!/bin/sh
echo " " >/tmp/backup.log
echo 'Starting Backup: ' `date` >>/tmp/backup.log
echo " " >>/tmp/backup.log
echo "blanking cd...">>/tmp/backup.log
echo `cdrecord dev=0,0,0 blank=all` >> /tmp/backup.log
echo ' ' >> /tmp/backup.log
echo "making /tmp/backup.ios">>/tmp/backup.log
echo `mkisofs -R -o /tmp/backup.iso /home` >> /tmp/backup.log
echo ' ' >>/tmp/backup.log
echo "burning cd...">>/tmp/backup.log
echo `cdrecord -v dev=0,0,0 /tmp/backup.iso` >>/tmp/backup.log
echo ' '>>/tmp/backup.log
echo 'Finished Backup: '`date`>>/tmp/backup.log
echo " ">>/tmp/backup.log
lp -d roland -o InputSlot=Tray1 /tmp/backup.log

If I do these commands at command line, pertinent (and  unfortunately
curses style) information is spit out, but it is not caught in my echo
`` calls.
Anyone have any ideas? I must admit i have enough shell scripting
syntax knowledge to be mostly dangerous to myself and others :-)

Wayner





More information about the redhat-list mailing list