Fifo buffer question

Chris Linstid clinstid at gmail.com
Thu Feb 6 14:56:42 EST 2014


>
> I have a background process running from which I would like, from time
> to time, to check the console output. I do not want to dedicate a
> console window to it, and since I start it from a script the console
> output is usually just lost to the akashic ethers.
>
> I've not played with fifo buffers, but I'm wondering. Could I start
> the process with " > fifo-buffer.txt" and then when I want to check
> the output, run a "tail -f fifo-buffer.txt" for a few minutes?
>
> Since this is not a usual background process with log rotation and
> such, I don't want to fill my disk with a text file dump. But it would
> be nice to check in and make sure it's running without killing it and
> restarting.
>

I would use a user defined signal handler. So, basically you send the
process a SIGUSR1 signal ("kill -SIGUSR1 <pid>")  and the signal handler
would dump the process status. You could either define an output file to
write to in the app itself or you could use stdout and redirect to a file
as you suggested. Either way, it would only dump text on demand.

What's the background process that you're doing this with? Every language
has its own way of registering a signal handler, including bash. There's a
decent write up about how to handle signals in bash here:

http://linuxcommand.org/wss0160.php

It mostly covers how to do cleanup if you get a SIGTERM or SIGHUP, but the
same would apply to SIGUSR1.

     - Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20140206/8d748eb9/attachment.html 


More information about the gnhlug-discuss mailing list