Last active
January 22, 2023 16:57
-
-
Save michalisFr/daa01c7374793a684a3a1f61e4959492 to your computer and use it in GitHub Desktop.
Polkadot node update script
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 | |
wget https://github.com/paritytech/polkadot/releases/download/v$1/polkadot && \ | |
wget https://github.com/paritytech/polkadot/releases/download/v$1/polkadot.sha256 && \ | |
sed -i 's+./artifacts/polkadot+polkadot+g' polkadot.sha256 | |
if sha256sum -c polkadot.sha256 2>&1 | grep -q 'OK' | |
then | |
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 | |
else | |
echo "** SHA256 doesn't match. Aborting **" | |
rm polkadot* | |
fi | |
echo done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
./update_node <version>
(without thev
in version). Example:./update_node 0.9.8
polkadot
: User running the service (change accordingly inchown 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 withCtrl+C