31 lines
520 B
Bash
Executable file
31 lines
520 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [ "$(whoami)" != "root" ]; then
|
|
echo -e "This script has to be run as \033[1mroot\033[0m user"
|
|
exit 3
|
|
fi
|
|
|
|
export LOG_FILE=/tmp/install.log
|
|
|
|
ufw allow 8333/tcp >> $LOG_FILE 2>&1
|
|
|
|
CONFIG_DIR=$HOME/.bitcoin
|
|
CONFIG=$CONFIG_DIR/bitcoin.conf
|
|
mkdir -p $CONFIG_DIR
|
|
PASS=$(openssl rand -hex 32)
|
|
|
|
cat > $CONFIG <<EOF
|
|
server=1
|
|
connections=40
|
|
rpcuser=lamassu
|
|
rpcpassword=$PASS
|
|
keypool=10000
|
|
prune=4000
|
|
daemon=0
|
|
EOF
|
|
|
|
pm2 start bitcoind >> $LOG_FILE 2>&1
|
|
pm2 save >> $LOG_FILE 2>&1
|
|
|
|
echo "Success."
|