-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
45 lines (39 loc) · 1.45 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
#!/bin/bash
set -u
BOOTSTRAP='bootstrap.tar.gz'
#
# Set passwd of bitsend user
#
echo bitsend:${BSDPWD} | chpasswd
#
# Downloading bitsend.conf
#
cd /tmp/
wget https://raw.githubusercontent.com/dalijolijo/BSD-Masternode-Setup/master/bitsend.conf -O /tmp/bitsend.conf
chown bitsend:bitsend /tmp/bitsend.conf
#
# Set rpcuser, rpcpassword and masternode genkey
#
printf "** Set rpcuser, rpcpassword and masternode genkey ***\n"
mkdir -p /home/bitsend/.bitsend
chown -R bitsend:bitsend /home/bitsend
sudo -u bitsend cp /tmp/bitsend.conf /home/bitsend/.bitsend/
sed -i "s/^\(rpcuser=\).*/rpcuser=bsdmasternode${BSDPWD}/" /home/bitsend/.bitsend/bitsend.conf
sed -i "s/^\(rpcpassword=\).*/rpcpassword=${BSDPWD}/" /home/bitsend/.bitsend/bitsend.conf
sed -i "s/^\(masternodeprivkey=\).*/masternodeprivkey=${MN_KEY}/" /home/bitsend/.bitsend/bitsend.conf
#
# Downloading bootstrap file
#
printf "** Downloading bootstrap file ***\n"
cd /home/bitsend/.bitsend/
if [ ! -d /home/bitsend/.bitsend/blocks ] && [ "$(curl -Is https://www.mybitsend.com/${BOOTSTRAP} | head -n 1 | tr -d '\r\n')" = "HTTP/1.1 200 OK" ] ; then \
sudo -u bitsend wget https://www.mybitsend.com/${BOOTSTRAP}; \
sudo -u bitsend tar -xvzf ${BOOTSTRAP}; \
sudo -u bitsend rm ${BOOTSTRAP}; \
fi
#
# Step Starting BitSend Service
#
# Hint: docker not supported systemd, use of supervisord
printf "*** Starting BitSend Service ***\n"
exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf