Manipulating cdrecord output to work well with cron

Levander levander at mindspring.com
Sat Jul 30 04:43:12 UTC 2005


Having given up on udftools on hoary because I just don't think that 
package works, I'm now trying to write a script to run via cron that 
will create an iso to backup my system.

Typically, cron scripts are written such that if the script succeeds 
there is no output.  This is so that if the script runs successfully, 
you don't have to get an email from cron.  You only get an email if 
something fails.  And, unless the point of the program is to display 
out, like ls, a successful run of a UNIX script traditionally isn't 
supposed to have any output.  However, I'm not being able to get 
cdrecord to follow these rules.

'cdrecord <blah blah blah> 1> /dev/null' does greatly reduce the output, 
but , I still get:

cdrecord: Warning: Running on Linux-2.6.10-5-686-smp
cdrecord: There are unsettled issues with Linux-2.5 and newer.
cdrecord: If you have unexpected problems, please try Linux-2.4 or Solaris.
scsidev: '/dev/hdc'
devname: '/dev/hdc'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
cdrecord: Warning: using unofficial version of libscg (ubuntu-0.8ubuntu1 
'@(#)scsitransp.c      1.91 04/06/17 Copyright\
 1988,1995,2000-2004 J. Schilling').

Which I assume the developers have decided to make warnings go to 
standard output instead of standard error.

I guess I could 'cdrecord <blah blah blah> 2>&1 /dev/null', but then the 
errors that I do want to see get eaten along with the standard output.

Anybody know a way around this so that if cdrecord succeeds, I don't get 
any output? 

How about an alternative to cdrecord?  I've seen cdburn mentioned a 
couple of times, but didn't see a hoary package for it in the repositories.

-Levander




More information about the ubuntu-users mailing list