overwrite conf file every run

This commit is contained in:
Jeffrey Paul 2016-04-11 05:43:05 +02:00
parent c9aecd86c8
commit 63477b2b5f
Signed by: sneak
GPG Key ID: 052443F4DF2A55C2
1 changed files with 5 additions and 10 deletions

View File

@ -3,20 +3,15 @@
export HOME="/var/lib/bitcoin"
# gen random pw for rpc server
DEFAULTPW=$(dd if=/dev/urandom bs=10 count=1 status=none | shasum | cut -b 1-20)
if [ ! -e "$HOME/bitcoin.conf" ]; then
echo "creating bitcoin.conf"
RANDOMPW=$(dd if=/dev/urandom bs=10 count=1 status=none | shasum | cut -b 1-20)
cat <<EOF > $HOME/bitcoin.conf
rpcuser=${BITCOIND_RPC_USER:-rpcuser}
rpcpassword=${BITCOIND_RPC_PASSWORD:-$DEFAULTPW}
rpcuser=${BITCOIND_RPCUSER:-rpcuser}
rpcpassword=${BITCOIND_RPCPASSWORD:-$RANDOMPW}
EOF
fi
chown -R bitcoin:bitcoin $HOME
exec chpst -ubitcoin \
bitcoind \
-printtoconsole \