sleep is not necessary since nc is blocking

This commit is contained in:
sesteves 2018-10-02 21:20:54 +01:00
parent 4991113aaa
commit 1310b92a33

View File

@ -6,9 +6,6 @@ FILENAME=$(ls stats-* | tail -n 1)
# number of lines to read
N=100
# time to sleep in milliseconds
SLEEP=100
# chunk filename
CHUNK_FILENAME="log-provider-chunk.csv"
@ -17,5 +14,4 @@ header=$(head -n 1 $FILENAME)
while true; do
paste <(echo $header) <(tail -n +2 $FILENAME | tail -n $N) --d '' > $CHUNK_FILENAME
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c $CHUNK_FILENAME)\r\nAccess-Control-Allow-Origin: *\r\n\r"; cat $CHUNK_FILENAME; } | nc -v -l -p 4870
sleep ${SLEEP}e-3
done