|
|
@ -1,6 +1,6 @@ |
|
|
|
#!/usr/bin/env bash |
|
|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
|
|
|
|
version="v1 20200212.0" |
|
|
|
version="v1 20200313.0" |
|
|
|
|
|
|
|
|
|
|
|
unset -v progname |
|
|
|
unset -v progname |
|
|
|
progname="${0##*/}" |
|
|
|
progname="${0##*/}" |
|
|
@ -97,7 +97,7 @@ print_usage() { |
|
|
|
usage: ${progname} [options] |
|
|
|
usage: ${progname} [options] |
|
|
|
|
|
|
|
|
|
|
|
options: |
|
|
|
options: |
|
|
|
-c back up database/logs and start clean |
|
|
|
-c back up database/logs and start clean (not for mainnet) |
|
|
|
(use only when directed by Harmony) |
|
|
|
(use only when directed by Harmony) |
|
|
|
-1 do not loop; run once and exit |
|
|
|
-1 do not loop; run once and exit |
|
|
|
-h print this help and exit |
|
|
|
-h print this help and exit |
|
|
@ -602,15 +602,19 @@ do |
|
|
|
BN_MA="${BN_MA+"${BN_MA},"}${bn}" |
|
|
|
BN_MA="${BN_MA+"${BN_MA},"}${bn}" |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
if ${start_clean} |
|
|
|
if [[ "${start_clean}" == "true" && "${network_type}" != "mainnet" ]] |
|
|
|
then |
|
|
|
then |
|
|
|
msg "backing up old database/logs (-c)" |
|
|
|
msg "cleaning up old database/logs (-c)" |
|
|
|
unset -v backup_dir now |
|
|
|
read -rp "Remove old database/logs? (Y/n) " yesno |
|
|
|
now=$(date -u +%Y-%m-%dT%H:%M:%SZ) |
|
|
|
echo |
|
|
|
mkdir -p backups |
|
|
|
if [[ "$yesno" == "y" || "$yesno" == "Y" ]]; then |
|
|
|
backup_dir=$(mktemp -d "backups/${now}.XXXXXX") |
|
|
|
unset -v backup_dir now |
|
|
|
mv harmony_db_* latest "${backup_dir}/" || : |
|
|
|
now=$(date -u +%Y-%m-%dT%H:%M:%SZ) |
|
|
|
rm -rf latest |
|
|
|
mkdir -p backups; rm -rf backups/* |
|
|
|
|
|
|
|
backup_dir=$(mktemp -d "backups/${now}.XXXXXX") |
|
|
|
|
|
|
|
mv -f harmony_db_* latest .dht* "${backup_dir}/" 2>/dev/null || : |
|
|
|
|
|
|
|
rm -rf latest |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
mkdir -p latest |
|
|
|
mkdir -p latest |
|
|
|
|
|
|
|
|
|
|
|