Continuous nc data acquisition fails ocassionally


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Continuous nc data acquisition fails ocassionally
# 8  
Old 05-24-2018
Another possible pitfall: It may be waiting in buffers between programs, rather than truly dead.
# 9  
Old 05-25-2018
After testing chubler_XL suggestion:
Code:
nc -ul -p 56045 -q -1 -vv | tee /tmp/pre-awk.dat | awk -F: 'NF > 1 {print strftime("%d-%m-%Y %H:%M:%S"),$0  }' | tee /tmp/pre-split.dat | split -d -a3 -C 1M --additional-suffix=`date +_AIVDM_%F_%H%M%S`.txt - aivdm/ &

I can say that it seems that the split command is stopping the whole sentence because there some data that arrives to pre-awk.data and not to pre-split.data

hicksd8 I'm working on GNU/Linux 9.4 and the file stream could be infinite, I'm dividing it with split in 1M files and curiously the process always ends between 3-4 files (3.5-4M). I dont think its a problem with the file size but maybe a buffer size or buffer waiting as Corona668 is pointing.

Any clues on how to trace this? I'm not having any error message
# 10  
Old 05-28-2018
It can be a problem of the ssh session?

I mean, if I do something like

AISdecode.sh
Code:
#!/bin/sh
#CONTINUOUS AIS DECODE TO PERIODICALLY JSON FILES
nc -ul -p 56045 -q -1 | awk -F: 'NF > 1 {print strftime("%d-%m-%Y %H:%M:%S"),$0;fflush();  }' > awk.txt 2>&1 &

and then execute ./AISdecode.sh &
should I have any problem when the ssh session closes?

Note that in this case I've added and fflush(); to the awk sentence, eliminated the split sentence and reidirect stderror and stdout to a file just to tests by parts and see if I can find the problem. I'm my last try without 2>&1 & it stopped with a file of 3.8 M, now I'm trying this, lets see.

Any more ideas? This should be working...
# 11  
Old 05-28-2018
To avoid issues with session timeout use screen

Run a screen session, detach, return to it later (attach).
There are, of course, other alternatives and utilities, but i find screen mature, so i recommend it.

Is it a real pain to try out BSD nc variant to check if you are having same symptoms ?

To really detected what is happening one would need to tcpdump (or equivalent) and examine the generated files after, looking for suspected behavior.
I see no other way of telling what is going on, if network level is the problem of some sort.

When did the problem surfaced ?
Did it stop working in some point after working for some time or ?

Hope that helps
Regards
Peasant.
# 12  
Old 05-28-2018
Would it make sense to start from the other side and flood the network and reception pipe from the sender side, by e.g. catting over MBytes and MBytes?

Last edited by RudiC; 05-28-2018 at 12:24 PM.. Reason: syntax
# 13  
Old 05-28-2018
Thanks Peasant, I will check screen

What do you mean by BSD nc variant?
The problem is a new issue, I mean is a new problem, I recently obtained this data stream and I want to save it continuously but at the moment I can't get a satisfactory result, from time to time the pipe stop receiving data and saving to the file.

I guess that from time to time some packect get lost or the transmission temporarely stops or the pipe buffer if filled so even when the data still being received the data storing get stuck.

I will keep trying
# 14  
Old 05-28-2018
The problem with buffers, if that is the problem, would be the buffer NOT filling, storing up data and waiting until its full.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Continuous for loop

Hi All, Please help ***************** a=100 and run for loop that will minus 30 from 100 an will display value run loop will run till display value will be 0 ***************** Thanking you (1 Reply)
Discussion started by: Praful Pednekar
1 Replies

2. Shell Programming and Scripting

Continuous Copying from a directory to another.

Hello Folks, Looking for a script, where i can check for the existing of the files in a directory and copying to another. How can i achieve it in loop for over period of time. whatever files comes into the folder copied in another without duplicate and should be continuous loop. ... (8 Replies)
Discussion started by: sadique.manzar
8 Replies

3. UNIX for Dummies Questions & Answers

Extracting data between continuous non empty xml tags

Hi, I need help in extracting only the phone numbers between the continuous non empty xml tags in unix. I searched through a lot of forum but i did not get exact result for my query. Please help Given below is the sample pipe delimited file. I have a lot of tags before and after... (6 Replies)
Discussion started by: zen01234
6 Replies

4. Shell Programming and Scripting

Continuous checking of a file

I have a requirement like this... I want to go to a particular server for which i have acess .I want to do a ssh to that server from one server and check if a file is theer or not..and i need the script to chcek continuosly till it finds the file.When it finds the file i want it to come out... (9 Replies)
Discussion started by: kanta_bhakti
9 Replies

5. UNIX for Advanced & Expert Users

Need info regarding CDP - continuous data protection

HI frnds, i am going to work on CDP(continuous data protection),does any one of them have any idea reg CDP ... any docs or Links...might be helpful to me in understanding it.... (1 Reply)
Discussion started by: deep
1 Replies
Login or Register to Ask a Question