dd054398f7a5f382d98c49a1efe451a901de4b1d
[swift-upb.git] / mfold / dohrv
1 #!/bin/bash
2 #   The script downloads logs in parallel,
3 #   feeds them into fifos; sort takes logs
4 #   from fifos, merges and gzips them;
5 #   the result is put into harvest/
6 #
7 if [ ! $SERVERS ]; then
8     SERVERS="servers.txt"
9 fi
10
11 rm -rf harvest
12 mkdir harvest
13
14 for s in `grep -v '#' $SERVERS`; do
15     mkfifo harvest/$s.fifo
16 done
17
18 for s in `grep -v '#' $SERVERS`; do
19     (if ssh $s "cat ./swift/lout.gz" | gunzip | \
20         ./logparse $s \
21         > harvest/$s.fifo ; then
22         echo $s harvest OK
23     else
24         echo $s harvest FAIL
25     fi) &
26 done  
27
28 # Ensure your version of sort is recent enough
29 # batch-size is critical for performance
30 LC_ALL=C sort -m -s --batch-size=64 harvest/*.fifo | gzip > harvest/swarm.log.gz &
31 wait
32 rm harvest/*.fifo
33
34 echo DONE