-
Notifications
You must be signed in to change notification settings - Fork 92
/
mkdata.sh
executable file
·45 lines (38 loc) · 906 Bytes
/
mkdata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# create the JSON files delivering the summarized mempool
MEMPOOL=mempool.log
createfile() {
(echo 'call(['; eval "$CMD"; echo '])') > $DESTDIR/$NAME.js.new
mv $DESTDIR/$NAME.js.new $DESTDIR/$NAME.js
}
createfile_unfiltered() {
NAME=$1
MINUTES=$2
CMD="tail -$MINUTES $MEMPOOL"
createfile
}
createfile_filtered() {
NAME=$1
MINUTES=$2
IVAL=$3
CMD="tail -$MINUTES $MEMPOOL | sed -n '1~${IVAL}p'"
createfile
}
createfile_all() {
NAME=all
IVAL=$1
CMD="sed -n '1~${IVAL}p' < $MEMPOOL"
createfile
}
createfile_unfiltered 2h 120
createfile_unfiltered 8h 480
createfile_unfiltered 24h 1440
createfile_filtered 2d 2880 2
createfile_filtered 4d 5760 4
createfile_filtered 1w 10080 7
createfile_filtered 2w 20160 14
createfile_filtered 30d 43200 30
createfile_filtered 3m 131040 90
createfile_filtered 6m 262080 180
createfile_filtered 1y 524160 360
createfile_all 360