Skip to content

Instantly share code, notes, and snippets.

@mesquka
Created July 14, 2020 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesquka/1f560f491008e007e0a61342e25ce951 to your computer and use it in GitHub Desktop.
Save mesquka/1f560f491008e007e0a61342e25ce951 to your computer and use it in GitHub Desktop.
Run a self-updating Monero node
#!/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
@mesquka
Copy link
Author

mesquka commented Jul 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment