views:

25

answers:

1

Let's say I have 10 programs (in terminals) working in tandem: {p1,p2,p3,...,p10}.

It's hard to keep track of all STDOUT debug statements in their respective terminal. I plan to create a GUI to keep track of each STDOUT such that, if I do:

-- Click on p1 would "tail" program 1's output. -- Click on p3 would "tail" program 4's output.

It's a decent approach but there may be better ideas out there? It's just overwhelming to have 10 terminals; I'd rather have 1 super terminal that keeps track of this.

And unfortunately, linux "screen" is not an option. RESTRICTIONS: I only have the ability to either: redirect STDOUT to a file. (or read directly from STDOUT).

+1  A: 

If you are looking for a creative alternative, I would suggest that you look at sockets.

If each program writes to the socket (rather than STDOUT), then your master terminal can act as a server and organize the output.

Now from what you described, it seems as though you are relatively constrained to STDOUT, however it could be possible to do something like this:

# (use netcat (or nc on some systems) to write to a socket on the provided port)
./prog1 | netcat localhost 12312

I'm not sure if this fits in the requirements of what you are doing (and it might be more effort than it is worth!), but it could provide a very stable solution.

EDIT: As was pointed out in the comments, netcat does exactly what you would need to make this work.

Stargazer712
Very sophisticated; I didn't even think of this! Very stable solution so now the GUI can determine if it's running based on the socket it receives! Thanks! If this solution isn't overkill, I'll probably do it!
Carlo del Mundo
By the way, is sockhelper a standard UNIX program? I can't seem to execute it
Carlo del Mundo
Glad you like it. Be careful to keep it simple, as something with this much overhead could easily eat up your entire day ;)
Stargazer712
No, sockhelper is a program that I suggested you write on your own as a helper program--thus my statement that it might be more effort than it is worth :)
Stargazer712
Try netcat (program 'nc'). It actually does what the "sockhelper" suggestion is. Remember, though, that the syntax would be more like "./prog1 | ./sockhelper 12312"
Jonathan
@Jonathan, good suggestion on netcat...and thanks for the correction :) (ironically, I only make that mistake on SO...)
Stargazer712
Alternatively, you can use FIFOs. Just create them with mkfifo and redirect your programs' output to them.
ninjalj
Thanks all! netcat made is simpler
Carlo del Mundo