Skip to content

Instantly share code, notes, and snippets.

@dirtyak
Created March 9, 2018 23:50
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 dirtyak/48c1101bd960c378b3f0c81e3f0a2d8c to your computer and use it in GitHub Desktop.
Save dirtyak/48c1101bd960c378b3f0c81e3f0a2d8c to your computer and use it in GitHub Desktop.
Script to automate git upload for xios blockchain daemon files
#!/bin/bash
#
#
FOLDER=".XIOS1"
cd $FOLDER
git pull
cd
# Get the block count from the wallet
block=`/root/xios/src/XIOSd -datadir=/root/$FOLDER -config=/root/$FOLDER/XIOS.conf getblockcount`
echo "folder is $FOLDER"
echo "block is $block"
echo "test done"
# Stop wallet
/root/xios/src/XIOSd -datadir=/root/$FOLDER -config=/root/$FOLDER/XIOS.conf stop
# Remove old copy
rm -r $HOME/xios_snap/database
rm -r $HOME/xios_snap/txleveldb
rm $HOME/xios_snap/banlist.dat
rm $HOME/xios_snap/peers.dat
rm $HOME/xios_snap/blk0001.dat
# Nuke old github
cd $HOME/xios_snap/
git commit -a -m "nuke"
git push
# Make a new copy my XIOSd files to upload dir
cp -r $HOME/$FOLDER/database $HOME/xios_snap/.
cp -r $HOME/$FOLDER/txleveldb $HOME/xios_snap/.
cp $HOME/$FOLDER/banlist.dat $HOME/xios_snap/.
cp $HOME/$FOLDER/peers.dat $HOME/xios_snap/.
cp $HOME/$FOLDER/blk0001.dat $HOME/xios_snap/.
# Upload that files
cd $HOME/xios_snap/
git add database
git add txleveldb
git add banlist.dat
git add peers.dat
git lfs track 'blk0001.dat'
git add .gitattributes "blk0001.dat"
# Commit changes
git commit -a -m "$block"
git push
# restart XIOSd
/root/xios/src/XIOSd -datadir=/root/$FOLDER -config=/root/$FOLDER/XIOS.conf -daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment