Created
July 14, 2020 15:48
-
-
Save mesquka/1f560f491008e007e0a61342e25ce951 to your computer and use it in GitHub Desktop.
Run a self-updating Monero node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RPC_USER=username | |
RPC_PASS=password | |
run() | |
{ | |
docker rm -f "monerod" | |
docker image rm -f xmrto/monero:latest | |
docker pull xmrto/monero:latest | |
docker run --restart=always -v ${PWD}/data:/home/monero/.bitmonero -itd -p 18081:18081 --name monerod xmrto/monero:latest monerod | |
} | |
if [ ! -d "$PWD/data" ] | |
then | |
mkdir $PWD/data | |
chmod -R 777 $PWD/data | |
exec 3<> $PWD/data/bitmonero.conf | |
echo "rpc-bind-ip=0.0.0.0" >&3 | |
echo "rpc-login=${RPC_USER}:${RPC_PASS}" >&3 | |
echo "confirm-external-bind=1" >&3 | |
fi | |
current_latest_tags="" | |
while [ 1 = 1 ] | |
do | |
latest_tags=`curl -X GET https://registry.hub.docker.com/v1/repositories/xmrto/monero/tags` | |
if [ "$current_latest_tags" != "$latest_tags" ] | |
then | |
run | |
current_latest_tags=$latest_tags | |
fi | |
docker start "monerod" | |
rm $PWD/data/bitmonero.log | |
sleep 3600s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need to have docker installed to run this script. Modify the values for RPC_USER and RPC_PASS at the top of this script and then run it with something like pm2 or as a systemd service.
This script uses xmr.to's monero docker container