I have an embedded Linux system with a very tiny amount of disk space. This system needs to run a program that continuously streams text to standard output, and I need to capture and log this information in case its needed for debugging purposes later. The embedded system is on a local network with a Linux server, and its on this server that I want to store the output log of the program running on the embedded system. So, what I am seeking is a way to stream output from the program across the network to the server, and the server will feed this data into a log file.
I thought that I could use nc/netcat to achieve this goal, but I'm having difficulty and haven't been able to find any good examples for how I could get this to work. Additionally, this log streaming is all going in a script file (one script on the server, and another on the embedded system) which needs to do many other things. So here's what I've got so far:
Server-side:
Code:
nc -l $NC_PORT > /tmp/deltatau.out &
ssh $LOGIN_DELTATAU@$IP_DELTATAU "/root/system_deltatau start"
Embedded-side:
Code:
/root/test_deltatau | nc $IP_IMCS $NC_PORT &
The server side script calls NC to listen on a port I specify, instructs it to place its output in a file in /tmp, and launches the process to run in the background. Then it uses ssh to execute the script on the embedded side. The embedded side script launches the program and attempts to send its output across the network via nc.
But right now the server-side output file doesn't get populated (its empty) and the ssh command does not return until the test_deltatau program is completely finished (it should return immediately after launching said program). So I think that nc isn't being fed this output data at all right now.
I may be using nc all wrong, or maybe there's a better tool for this job than nc. I'm still playing around and trying a few different ideas that I have, but I was hoping that someone had experience solving this problem and was willing to share their advice. I'm trying to use as simple of a solution as possible, hopefully not requiring any custom software that is not already on a standard Linux system (recall, my embedded Linux system is very short on disc space). Thanks.