changeset 409:c059e112e719

move files
author Marc Davis <marc.davis@mcoecn.org>
date Wed, 12 Oct 2022 19:13:38 -0400
parents e49038cbb14c
children b5d278d98872 bec563a3ac22
files prod/backup-itcm.sh prod/restore-itcm.sh scripts/backup-itcm.sh scripts/restore-itcm.sh
diffstat 4 files changed, 56 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/prod/backup-itcm.sh	Mon Oct 10 14:32:06 2022 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
-
-${SSDT_SCRIPTS}/backup-container-docker.sh itcmdb ${1}
\ No newline at end of file
--- a/prod/restore-itcm.sh	Mon Oct 10 14:32:06 2022 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
-
-sourceFile=${1?must provide backup file to be restored}
-
-if [ -z "$1" ]
-then
-  echo "Usage: `basename $0` {backup file to restore}"
-  echo " must specify the name of the file to restore.  Assumed to be in format:"
-  echo "     {entityId}-itcm-db.{timestamp}.backup.gz  "
-  exit $E_NOARGS
-fi
-
-function prop {
-   grep "${1}" .env/itcm-shared.properties|cut -d'=' -f2
-}
-
-entityId=$(prop 'entityId' | tr -d '"')
-dbContainerName="$entityId-itcm-db"
-appContainerName="$entityId-itcm-app"
-target="itcmdb"
-
-echo 
-echo "Preparing to restore"
-echo "--------------------"
-echo "   file: $sourceFile"
-echo "   to    $dbContainerName database: $target"
-echo " "
-echo "WARNING:  This operation will DELETE and replace any exising database"
-echo " "
-
-read -e -p "Continue? <y/N> " answer
-case $answer in
-     y | Y | yes | YES ) answer="y";;
-     n | N | no | NO ) answer="n";;
-     *) answer="n"
-esac
-
-if [ "$answer" == "y" ] 
-then
-  echo "stopping application service $appContainerName"
-  docker stop $appContainerName
- 
-  echo "copy backup file to database container"
-  docker cp ${sourceFile} ${dbContainerName}:/tmp/restore.backup.gz
-
-  echo "starting database restore"
-  docker exec -t -u postgres $dbContainerName sh -c "gunzip -f /tmp/restore.backup.gz -c | psql"
-
-fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/backup-itcm.sh	Wed Oct 12 19:13:38 2022 -0400
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
+
+${SSDT_SCRIPTS}/backup-container-docker.sh itcmdb ${1}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/restore-itcm.sh	Wed Oct 12 19:13:38 2022 -0400
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
+
+sourceFile=${1?must provide backup file to be restored}
+
+if [ -z "$1" ]
+then
+  echo "Usage: `basename $0` {backup file to restore}"
+  echo " must specify the name of the file to restore.  Assumed to be in format:"
+  echo "     {entityId}-itcm-db.{timestamp}.backup.gz  "
+  exit $E_NOARGS
+fi
+
+function prop {
+   grep "${1}" .env/itcm-shared.properties|cut -d'=' -f2
+}
+
+entityId=$(prop 'entityId' | tr -d '"')
+dbContainerName="$entityId-itcm-db"
+appContainerName="$entityId-itcm-app"
+target="itcmdb"
+
+echo 
+echo "Preparing to restore"
+echo "--------------------"
+echo "   file: $sourceFile"
+echo "   to    $dbContainerName database: $target"
+echo " "
+echo "WARNING:  This operation will DELETE and replace any exising database"
+echo " "
+
+read -e -p "Continue? <y/N> " answer
+case $answer in
+     y | Y | yes | YES ) answer="y";;
+     n | N | no | NO ) answer="n";;
+     *) answer="n"
+esac
+
+if [ "$answer" == "y" ] 
+then
+  echo "stopping application service $appContainerName"
+  docker stop $appContainerName
+ 
+  echo "copy backup file to database container"
+  docker cp ${sourceFile} ${dbContainerName}:/tmp/restore.backup.gz
+
+  echo "starting database restore"
+  docker exec -t -u postgres $dbContainerName sh -c "gunzip -f /tmp/restore.backup.gz -c | psql"
+
+fi