-
Notifications
You must be signed in to change notification settings - Fork 6
/
start.sh
executable file
·49 lines (38 loc) · 1.04 KB
/
start.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
46
47
48
49
#!/bin/bash
set -e
GRN='\e[32;1m'
RED='\033[0;31m'
BOLDW='\e[1m'
OFF='\e[0m'
error() {
local message="$2"
local code="${3:-1}"
if [[ -n "$message" ]] ; then
echo -e "${RED} Error: ${message}; exiting with status ${code} ${OFF}"
else
echo -e "${RED} Error; exiting with status ${code} ${OFF}"
fi
exit_func "${code}"
}
exit_func() {
echo -e "${GRN}Exiting...${OFF}"
trap - SIGINT SIGTERM
kill -- -$$
exit "$1"
}
echo -e "${GRN}Running command: ${OFF}${BOLDW}lotus daemon $1 $2${OFF}"
[ -z "$GOLOG_LOG_LEVEL" ] && export GOLOG_LOG_LEVEL=INFO
echo -e "${GRN}Using Lotus logger level:${OFF}${BOLDW} ${GOLOG_LOG_LEVEL} ${OFF}"
lotus daemon $1 $2 2>&1 &
trap 'error ${LINENO}' ERR
trap 'exit_func 0' INT SIGINT
LOTUS_CHAIN_INDEX_CACHE=32768
LOTUS_CHAIN_TIPSET_CACHE=8192
until [ -f /data/node/token ]
do
echo -e "${GRN}Waiting for token file to be created by lotus... ${OFF}$"
sleep 5
done
LOTUS_RPC_TOKEN=$( cat /data/node/token )
echo -e "${GRN}### Launching rosetta-filecoin-proxy${OFF}"
rosetta-filecoin-proxy 2>&1