forked from dk808/Raptoreum_SmartNode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
53 lines (46 loc) · 1.05 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
50
51
52
53
#!/bin/bash
EXECUTABLE='raptoreumd'
DIR='/raptoreum/.raptoreumcore'
CONF_FILE='raptoreum.conf'
FILE=$DIR/$CONF_FILE
if [ -n "$CONF" ] && [ -e "$FILE" ]; then
rm $FILE
fi
if [ "$FORCE_BOOTSTRAP" == "true" ] && [ -d $DIR ]; then
rm -rf $DIR
bootstrap.sh
fi
# Create directory and config file if it does not exist yet
mkdir -p $DIR
cat <<EOF >$FILE
rpcuser=${RPC_USER}
rpcpassword=${RPC_PASSWORD}
rpcallowip=172.0.0.0/8
rpcallowip=127.0.0.1
rpcbind=0.0.0.0
server=1
listen=1
externalip=${EXTERNALIP}
addnode=lbdn.raptoreum.com
addnode=explorer.raptoreum.com
printtoconsole=1
EOF
if [ -n "${RPC_ALLOW_IP}" ]; then
echo "rpcallowip=${RPC_ALLOW_IP}" >> $FILE
fi
# Добавляем testnet, если переменная установлена
if [ -n "${TESTNET}" ]; then
echo "testnet=${TESTNET}" >> $FILE
fi
# Setup logrotate for debug log
touch /etc/logrotate.d/rtmdebuglog
cat <<EOF >/etc/logrotate.d/rtmdebuglog
/raptoreum/.raptoreumcore/debug.log {
compress
copytruncate
missingok
daily
rotate 7
}
EOF
exec $EXECUTABLE -datadir=$DIR -conf=$FILE