2016-04-11 03:38:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export HOME="/var/lib/bitcoin"
|
|
|
|
|
|
|
|
# gen random pw for rpc server
|
2016-04-11 03:43:05 +00:00
|
|
|
RANDOMPW=$(dd if=/dev/urandom bs=10 count=1 status=none | shasum | cut -b 1-20)
|
2016-04-11 03:38:48 +00:00
|
|
|
|
2016-04-11 03:43:05 +00:00
|
|
|
cat <<EOF > $HOME/bitcoin.conf
|
|
|
|
rpcuser=${BITCOIND_RPCUSER:-rpcuser}
|
|
|
|
rpcpassword=${BITCOIND_RPCPASSWORD:-$RANDOMPW}
|
2016-04-11 03:38:48 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
chown -R bitcoin:bitcoin $HOME
|
2016-04-11 03:43:05 +00:00
|
|
|
|
2016-04-11 03:38:48 +00:00
|
|
|
exec chpst -ubitcoin \
|
|
|
|
bitcoind \
|
|
|
|
-printtoconsole \
|
|
|
|
-disablewallet \
|
2016-04-11 15:51:16 +00:00
|
|
|
-datadir=/var/lib/bitcoin \
|
|
|
|
-conf=/var/lib/bitcoin/bitcoin.conf \
|
2016-04-11 03:38:48 +00:00
|
|
|
-rpcallowip=::/0 \
|
|
|
|
$BITCOIND_EXTRA_OPTS \
|
|
|
|
2>&1
|