Skip to content

Commit

Permalink
Auxiliary scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
arocha committed Dec 13, 2017
1 parent a9872f3 commit f408ab2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Makes a node backup

MESSAGE="Usage: backup keys | full"
if ( [ $# -ne 1 ] ); then
echo "$MESSAGE"
exit
fi

CURRENT_DATE=`date +%Y%m%d%H%M%S`


if ( [ "keys" == "$1" ]); then
echo "Making a backup of your current node keys ..."

#Backup directory tree
mkdir ~/alastria-keysBackup-$CURRENT_DATE
mkdir ~/alastria-keysBackup-$CURRENT_DATE/data
mkdir ~/alastria-keysBackup-$CURRENT_DATE/data/geth
mkdir ~/alastria-keysBackup-$CURRENT_DATE/data/constellation
echo "Saving constellation keys ..."
cp -r ~/alastria/data/constellation/keystore ~/alastria-keysBackup-$CURRENT_DATE/data/constellation
echo "Saving node keys ..."
cp -r ~/alastria/data/keystore ~/alastria-keysBackup-$CURRENT_DATE/data
echo "Saving enode ID ..."
cp ~/alastria/data/geth/nodekey ~/alastria-keysBackup-$CURRENT_DATE/data/nodekey
fi

if ( [ "full" == "$1" ]); then
echo "Making a complete backup of your current node..."
cp -r ~/alastria ~/alastria-backup-$CURRENT_DATE
echo "Cleaning unnecessary files..."
rm -Rf ~/alastria-backup-$CURRENT_DATE/logs/*
rm -Rf ~/alastria-backup-$CURRENT_DATE/data/keystore/*
rm -Rf ~/alastria-backup-$CURRENT_DATE/data/geth/nodekey
rm -Rf ~/alastria-backup-$CURRENT_DATE/data/constellation/keystore/*
fi
8 changes: 8 additions & 0 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Prepare the node for a clean restart

echo "Preparing the node for a clean restart ..."
rm -Rf ~/alastria/logs/*
rm -Rf ~/alastria/data/keystore/*
rm -Rf ~/alastria/data/geth/nodekey
rm -Rf ~/alastria/data/constellation/keystore/*

0 comments on commit f408ab2

Please sign in to comment.