forked from poanetwork/hydrabadger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ltrace-node
executable file
·56 lines (46 loc) · 1.22 KB
/
ltrace-node
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
46
47
48
49
50
51
52
53
54
55
56
#/bin/bash
# Starts a Hydrabadger node
# =========================
#
# Optional environment variables:
#
# * HYDRABADGER_LOG_ADDTL:
#
# Appends additional logging args (debug, trace, filters, etc.).
#
# * HYDRABADGER_RELEASE:
#
# Builds in debug mode if `HYDRABADGER_RELEASE` == `0` or `false`.
# Slows down output and makes reading log easier.
#
#
let HOST_ID=$1
let PEER_0_ID=$HOST_ID==0?$HOST_ID+2:$HOST_ID-1
let PEER_1_ID=$HOST_ID+1
printf -v HOST_PORT "3%03d" $HOST_ID
printf -v PEER_0_PORT "3%03d" $PEER_0_ID
printf -v PEER_1_PORT "3%03d" $PEER_1_ID
HYDRABADGER_LOG=peer_node::hydrabadger=error,warn,info,$HYDRABADGER_LOG_ADDTL
if [[ $HYDRABADGER_RELEASE ]]
then
case "$HYDRABADGER_RELEASE" in
0|false) RELEASE=""; DIRECTORY="debug" ;;
*) RELEASE="--release"; DIRECTORY="release" ;;
esac
else
RELEASE="--release"
DIRECTORY="release"
fi
set -e
cargo build $RELEASE
# printf "\nLimiting process memory limit to 400MiB...\n\n"
# ulimit -Sv 400000
mkdir tmp
bash -c "\
HYDRABADGER_LOG=$HYDRABADGER_LOG ltrace target/$DIRECTORY/peer_node \
-b localhost:$HOST_PORT \
-r localhost:$PEER_0_PORT \
-r localhost:$PEER_1_PORT\
$2 $3 $4 $5 $6 $7 $8 \
2>&1 | tee tmp/ltrace_peer_node_$1.log
"