Skip to content

Instantly share code, notes, and snippets.

Last active January 22, 2023 16:57
What would you like to do?
Polkadot node update script
#! /bin/bash
wget$1/polkadot && \
wget$1/polkadot.sha256 && \
sed -i 's+./artifacts/polkadot+polkadot+g' polkadot.sha256
if sha256sum -c polkadot.sha256 2>&1 | grep -q 'OK'
echo "** SHA256 matches **"
chmod +x polkadot && \
sudo chown polkadot:polkadot polkadot && \
sudo systemctl stop polkadot.service && \
sudo mv polkadot /usr/local/bin/polkadot && \
rm polkadot.sha256 && \
sudo systemctl start polkadot.service && \
sudo journalctl -f -u polkadot.service
echo "** SHA256 doesn't match. Aborting **"
rm polkadot*
echo done!
Copy link

Usage: ./update_node <version> (without the v in version). Example: ./update_node 0.9.8
polkadot: User running the service (change accordingly in chown polkadot:polkadot)
polkadot.service: Service name (change accordingly in all instances)
The last line journalctl will run the service logs to check the update has been successful. Exit with Ctrl+C

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