Re: Start a program and get a hold of it's STDOUT and STDIN?



Snail <snail@xxxxxxxxxxxxx> wrote:
> Hello. I am trying to write a logging program to wrap around a server
> program that we need that doesn't have logging capabilities of it's own.
> Normally, one would just redirect it on the command line:

> ./server 2>&1 logfile.log

> But this doesn't have any dating what so ever and it can get hard to
> read as it grows.

> I've been search all over (perldoc, google, etc) and all I could find
> was examples of getting STDIN or STDOUT (using pipes) but not both at
> the same time. Further mode, I need this to be in real time (when the
> server spits out something to STDOUT/ERR I want my program to
> immediately get this, and then process it (add a line to the log file,
> perform some processing if a certain event occurs, such has a new
> connection, etc.)

% server 2>&1 | wrapper_prog

Axel
.



Relevant Pages

  • Re: last character of the last line is a newline?
    ... Would it be possible to redirect only to a file. ... output to standard output. ... # to stdout and to your_file ... Substitute your_program by the compound command of your original posting: ...
    (comp.unix.shell)
  • Re: Cron Daemon backup message too big
    ... What this command does is to concatenate stdout + errors and redirect ... Could I avoid this by terminating the command line instead like this: ... though you need a redirect to the file too like so: ...
    (Debian-User)
  • Re: Pipes and interprocess communication
    ... > command line argument) as a separate process. ... I redirect the stdout, ... > I then redirect the stdout of my program from the command line: ...
    (microsoft.public.vc.language)
  • Re: Redirecting STDOUT
    ... output of stdout redirected to a file. ... impression the following would redirect stdout to a file, ... This is highly shell dependent but on ksh, this command works. ... The above command will redirect stderr to the bit bucket and ...
    (freebsd-questions)
  • Re: Can you duplicate Standard Output WITHOUT tee command?
    ... run where he wanted to catch stdout. ... Yes, this is a difficult command pipe, especially as written it uses ... The last file descriptor operations restore the normal meaning of stdin ...
    (comp.unix.shell)