diff scripts/backup-container.sh @ 314:d78b45c28205

backup script adding IRN to name
author aldrich@ssdt-ohio.org
date Mon, 28 Oct 2019 19:43:53 +0100
parents 4cc087cde1d0
children 58c49a386a11
line wrap: on
line diff
--- a/scripts/backup-container.sh	Thu Jun 27 19:21:53 2019 +0100
+++ b/scripts/backup-container.sh	Mon Oct 28 19:43:53 2019 +0100
@@ -19,8 +19,17 @@
 
 set -o pipefail
 mkdir -p ./backup
-backupFile=./backup/${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup
+##
+##THis one puts a space before the IRN
+IRN=$(docker-compose exec -T $container psql --username=postgres --dbname=$container -t -c 'select irn from organization') 
+##Trim function in postgres didn't work - so take out the extra space this way.
+IRN=`echo $IRN | sed -e 's/^[[:space:]]*//'`
 
+backupFile=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup
+#echo "IRNS${IRNS}"
+echo "IRN${IRN}"
+
+echo "backup file ${backupFile}"
 echo "preparing to backup ${container} on current project at ${projectDir}:"
 echo " "