improved script parametrization
This commit is contained in:
parent
d9413269f2
commit
8e542d5187
@ -1,5 +1,19 @@
|
|||||||
#/bin/bash
|
# last stats file to read from
|
||||||
while true
|
FILENAME=$(ls stats-* | tail -n 1)
|
||||||
do
|
|
||||||
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <top.csv)\r\nAccess-Control-Allow-Origin: *\r\n\r"; cat top.csv; } | nc -v -l -p 4870
|
# number of lines to read
|
||||||
|
N=100
|
||||||
|
|
||||||
|
# time to sleep in milliseconds
|
||||||
|
SLEEP=100
|
||||||
|
|
||||||
|
# chunk filename
|
||||||
|
CHUNK_FILENAME="log-provider-chunk.csv"
|
||||||
|
|
||||||
|
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
|
done
|
||||||
|
Reference in New Issue
Block a user