-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
44 lines (38 loc) · 1.29 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
#!/bin/bash
set -u
BOOTSTRAP='bootstrap.tar.gz'
#
# Set passwd of bitcore user
#
echo bitcore:${BTXPWD} | chpasswd
#
# Downloading bitcore.conf
#
cd /tmp/
wget https://raw.githubusercontent.com/LIMXTEC/Bitcore-BTX-RPC-Installer/master/bitcore.conf -O /tmp/bitcore.conf
chown bitcore:bitcore /tmp/bitcore.conf
#
# Configure bitcore.conf
#
printf "** Configure bitcore.conf ***\n"
mkdir -p /home/bitcore/.bitcore
chown -R bitcore:bitcore /home/bitcore/
sudo -u bitcore cp /tmp/bitcore.conf /home/bitcore/.bitcore/bitcore.conf
sed -i "s/^\(rpcuser=\).*/rpcuser=btxrpcnode${BTXPWD}/" /home/bitcore/.bitcore/bitcore.conf
sed -i "s/^\(rpcpassword=\).*/rpcpassword=${BTXPWD}/" /home/bitcore/.bitcore/bitcore.conf
#
# Downloading bootstrap file
#
printf "** Downloading bootstrap file ***\n"
cd /home/bitcore/.bitcore/
if [ ! -d /home/bitcore/.bitcore/blocks ] && [ "$(curl -Is https://bitcore.cc/${BOOTSTRAP} | head -n 1 | tr -d '\r\n')" = "HTTP/1.1 200 OK" ] ; then \
sudo -u bitcore wget https://bitcore.cc/${BOOTSTRAP}; \
sudo -u bitcore tar -xvzf ${BOOTSTRAP}; \
sudo -u bitcore rm ${BOOTSTRAP}; \
fi
#
# Starting BitCore Service
#
# Hint: docker not supported systemd, use of supervisord
printf "*** Starting BitCore Service ***\n"
exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf