diff scripts/remote-backup.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 146c0c263cf9
line wrap: on
line diff
--- a/scripts/remote-backup.sh	Thu Jun 27 19:21:53 2019 +0100
+++ b/scripts/remote-backup.sh	Mon Oct 28 19:43:53 2019 +0100
@@ -27,13 +27,18 @@
 
 project=$(composeGetProject)
 
+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:]]*//'`
+
 echo "Project is $project"
 echo "Container is $container"
 echo "Remote target is $remoteTarget"
 echo "Username is $userName"
+echo "IRN is $IRN"
 
-backupFile=./backup/${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup
-backupFile2=./backup/${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).directorycontents.tar.gz
+backupFile=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup
+backupFile2=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).directorycontents.tar.gz
 
 
 if [ "$project" == "" ]; then
@@ -55,7 +60,8 @@
 echo "completed backup of $container for $project to ${backupFile}"
 
 #backup of all files in current directory
-tar -czf ${backupFile2} . --exclude=./backup
+#tar -czf ${backupFile2} . --exclude=./backup
+tar --exclude=./backup -czf ${backupFile2} .
 
 echo "completed backup of all files for $project to ${backupFile2}"