Re: Redirection output for a program in background



On 2008-03-10, Mad Ant <anton.harris@xxxxxxxxx> wrote:
Hello all.

I have a little question concerning the redirections of text. I know
it's possible to redirect the output when starting the program from
the command line, with pipes and greater-thans and so on.
However, I have a program that starts at boot and runs as a daemon,
which also prints text to standard output.
But since it's started at boot, I have no access to the output that's
being printed.

The question I want to ask is this : is it possible, while a program
is running, to redirect the standard output on the fly to a terminal
to see the output text being produced ?
This would be especially useful for me, since I have to sometimes
administer machines via SSH.

I know it's possible to look at the file /var/log/messages, but since
it receives all the text, I don't want to have to meander through the
files to find the text being printed from my program.

Many thanks for any help that can be provided.

Mad Ant

You could have cron run a script that greps out the lines from
/var/log/messages that you want, every N minutes/seconds, putting
them in a seperate file, then have a function that runs tail -f
on that new file with a couple of keystrokes:

cv () { tail -f /tmp/special; }

Tom

--
calhobbit (at) | The Truth will set you free:
gmail [DOT] com | http://www.sethcenter.com

.



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: nohup
    ... i am not sure about this command. ... standard output or standard error - the '>outputfile' would redirect ... standard output to 'outputfile', and the '2>&1' would redirect standard ...
    (comp.unix.aix)
  • Re: Redirecting the standard error and output
    ... > standard output by following command ... > But I was not able to redirect my error messages from the above ... Which the command for redirecting both error ...
    (microsoft.public.vc.language)
  • Re: Redirection output for a program in background
    ... But since it's started at boot, I have no access to the output that's ... to redirect the standard output on the fly to a terminal ... I did think of a similar solution, ie writing a script ...
    (comp.os.linux.misc)
  • Redirection output for a program in background
    ... the command line, with pipes and greater-thans and so on. ... But since it's started at boot, I have no access to the output that's ... to redirect the standard output on the fly to a terminal ...
    (comp.os.linux.misc)