New output channel for shell

New output channel for shell

Post by Jens-Uwe Spierin » Wed, 04 Oct 2000 04:00:00



Hi all,

i have script wich has to use a logfile very often to store all information.
For the moment i use the 'normal' syntax  echo "Whats going on" >> $logfile

I was thinking about opening a new output channel for shell (ksh)
exec 3> $logfile
and to echo all information into it with print -u3 "Whats going on"

But am not sure if i create more problems than i get advantages. As i
understood the output channel stays open all the time until i close it
explicitly with 'exec 3>&-' , actually this should save time during running
the script, but what happens when i am not able to close the channel in case
the script hangs,fails,aborts unexpected...

Are there any other things i have to care about?

Anybody using this ?
Any information on this are welcome
Thanx in advance
-jens-

 
 
 

New output channel for shell

Post by Barry Margoli » Wed, 04 Oct 2000 04:00:00




>Hi all,

>i have script wich has to use a logfile very often to store all information.
>For the moment i use the 'normal' syntax  echo "Whats going on" >> $logfile

>I was thinking about opening a new output channel for shell (ksh)
>exec 3> $logfile
>and to echo all information into it with print -u3 "Whats going on"

>But am not sure if i create more problems than i get advantages. As i
>understood the output channel stays open all the time until i close it
>explicitly with 'exec 3>&-' , actually this should save time during running
>the script, but what happens when i am not able to close the channel in case
>the script hangs,fails,aborts unexpected...

I don't think any of those things should be much of a problem.  However, a
problem could be if your script runs continuously in the background and you
need to rotate the logfile.  When you rename it, your script will continue
writing to the old file under its new name; it only notices the name change
when it opens the file.  So you would have to provide some way to tell the
script that it should close the file and reopen it (this is what happens
when you send SIGHUP to syslogd).

For most shell scripts, the overhead of reopening the logfile each time you
echo something to it is negligible, so I wouldn't bother complicating the
script for this.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. New: VIA 8235 rear channel playback on front channels?

http://bugme.osdl.org/show_bug.cgi?id=379

           Summary: VIA 8235 rear channel playback on front channels?
    Kernel Version: 2.5.62
            Status: NEW
          Severity: normal


Distribution:  Slackware 8.1
Hardware Environment:  EPIA-M 9000
Software Environment:  VIA 8235 ALSA kernel drivers
Problem Description:  During DVD playback on Mplayer, (using ALSA sound), sound
only comes out of the main two channels (front left and right), but that sound
is supposed to be in the REAR two channels.

Steps to reproduce:  I switched back to 2.5.61 with the same items build into
the kernel.  Sound was as normal for 2 channel support. (front left and right).
 Booted back to 2.5.62 and repeated the same problem.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. partition limit

3. pppd: "Couldn't get channel number: Input/output error"

4. VPN Server

5. Audio: 4 and 6 channel Output

6. dynamic linking with R6, Motif 1.1.4, Linux: how?

7. sendmail: error on output channel

8. help with X configuration

9. xterm as output-channel

10. Video Capture for Stereo Vision : A 2-channel or two 1-channel ?

11. Change volume on one channel in a stereo stream and not affect the other channel

12. Raid 0+1 and 2 channel 3200s controller - How to best utilize 2 channels ?

13. New shell available: ERGO-Shell 2.1