forked from calr0x/OT-Smoothbrain-Backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharangorestore-dockerless.sh
executable file
·42 lines (32 loc) · 1.27 KB
/
arangorestore-dockerless.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
BACKUPDIR="/root/backup"
CONFIGDIR="/root/.origintrail_noderc/mainnet"
temp_folder=$BACKUPDIR
for file in `ls ${BACKUPDIR}`; do
if [ ! ${file} == "arangodb" ]
then
if [ ! ${file} == "migrations" ]
then
sourcePath="${BACKUPDIR}/${file}"
destinationPath="${CONFIGDIR}/"
sourcePath=${temp_folder}/${file}
echo "cp ${sourcePath} ${destinationPath}"
cp ${sourcePath} ${destinationPath}
fi
fi
done
sourcePath=${BACKUPDIR}/.origintrail_noderc
destinationPath="/ot-node/current/"
echo "cp ${sourcePath} ${destinationPath}"
cp ${sourcePath} ${destinationPath}
migrationDir="${BACKUPDIR}/migrations"
if [ -d ${migrationDir} ]
then
sourcePath=${BACKUPDIR}/migrations
destinationPath="${CONFIGDIR}/"
echo "cp ${sourcePath} ${destinationPath}"
cp -r ${sourcePath} ${destinationPath}
fi
databasePassword=$(cat /root/.origintrail_noderc/mainnet/arango.txt)
echo "arangorestore --server.database origintrail --server.username root --server.password "root" --input-directory backup/arangodb/ --overwrite true --create-database true"
arangorestore --server.database origintrail --server.username root --server.password "${databasePassword}" --input-directory /root/backup/arangodb/ --overwrite true --create-database true