Manipulating cdrecord output to work well with cron

Yannick Le Saint (kyncani) y.lesaint at gmail.com
Sat Jul 30 11:02:51 UTC 2005


On Fri, 2005-07-29 at 21:43 -0700, Levander wrote:
> Anybody know a way around this so that if cdrecord succeeds, I don't get 
> any output?

  I would do it using a log file. The command line in cron :

{ echo starting; if cdrecord blah blah blah 2>&1; then echo SUCCESS;
else echo FAILURE; echo "Cdrecord failure (`date`), check
$HOME/.cdrecord.log for details." >&2; fi; } | sed "s#^#`date`
cron-cdrecord $$: #" >>$HOME/.cdrecord.log

  Obviously, you'll have to setup logrotate to rotate your
$HOME/.cdrecord.log log file.
  And, well, that's some cron command ;)


  Or you could use a temp file, but i don't like it :

cdrecord blah blah blah &>$HOME/.cdrecord.log || cat $HOME/.cdrecord.log


  I prefer the log file way because it keeps an history of cdrecord
logs, always useful when you have a problem.


------
Regards.

Yannick Le Saint (kyncani) <y.lesaint at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050730/fd7a28ea/attachment.sig>


More information about the ubuntu-users mailing list