annotate scripts/restore-ess.sh @ 553:39114f8cda17

add export
author belknapSSDT <zach.belknap@mcoecn.org>
date Thu, 23 May 2024 11:05:21 -0400
parents e483148f5283
children 6f7ae8d659cf
rev   line source
528
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
2
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
3 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
4
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
5 sourceFile=${1?must provide backup file to be restored}
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
6
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
7 if [ -z "$1" ]
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
8 then
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
9 echo "Usage: `basename $0` {backup file to restore}"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
10 echo " must specify the name of the file to restore. Assumed to be in format:"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
11 echo " {entityId}-ess-db.{timestamp}.backup.gz "
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
12 exit $E_NOARGS
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
13 fi
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
14
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
15 function prop {
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
16 grep "${1}" .env/ess-shared.properties|cut -d'=' -f2
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
17 }
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
18
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
19 entityId=$(prop 'entityId' | tr -d '"')
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
20 dbContainerName="$entityId-ess-db"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
21 appContainerName="$entityId-ess-app"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
22 target="essdb"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
23
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
24 echo
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
25 echo "Preparing to restore"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
26 echo "--------------------"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
27 echo " file: $sourceFile"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
28 echo " to $dbContainerName database: $target"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
29 echo " "
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
30 echo "WARNING: This operation will DELETE and replace any exising database"
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
31 echo " "
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
32
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
33 read -e -p "Continue? <y/N> " answer
e483148f5283 Add backup, restore, and update ess scripts. Handle ess in workflows update and remove container stop/removal from install ess script.
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
34