ufsdump ksh puzzle

From: Chris Hoogendyk (hoogendyk@bio.umass.edu)
Date: Mon May 01 2006 - 15:40:33 EDT


ufsdump puts its messages out to standard error.

I believe this is to avoid conflict with the case where the dump is
going to standard out and piped somewhere else (to ufsrestore on another
partition, or to ssh to dd to a tape drive on another server).

So, suppose you have a cron job running ufsdump piped to ssh to a drive
on another server. The script runs a long time. You want to know what it
is doing. So, you set up a log file. Various commands in the script use
tee to the log file. Then you get a log file you can look at, and when
it's all done you get a mail message with the output of the cron job.

However, the puzzle is that I can't seem to find any way to redirect
standard error so that it goes to a log file as well as to the output of
the cron job that appears in the mail message.

Examples:

This works:

      /usr/lib/fs/ufs/ufsdump ${LEVEL}cnlTfuN 2h /dev/rmt/0n ${RDEV}
${WHICHSNAP} 2>&1 | tee -a ${LOGFILE};

This also works:

    /usr/lib/fs/ufs/ufsdump ${LEVEL}cnlTfuN 2h - ${RDEV} ${WHICHSNAP} |
su - backup -c "ssh ${TAPESERVER} \"dd obs=64b of=/dev/rmt/0n\"";

But in the second one I can't use 2>&1, because standard out is the
dump. I can do 2>logfile, but I can't do .... I have no idea what the
proper syntax or approach would be.

---------------

Chris Hoogendyk

-
   O__ ---- Systems Administrator
  c/ /'_ --- Biology & Geology Departments
 (*) \(*) -- 140 Morrill Science Center
~~~~~~~~~~ - University of Massachusetts, Amherst

<hoogendyk@bio.umass.edu>

---------------

Erdvs 4
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:39:43 EDT