comparison 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
comparison
equal deleted inserted replaced
313:06e92ad77e7f 314:d78b45c28205
25 set -o pipefail 25 set -o pipefail
26 mkdir -p ./backup 26 mkdir -p ./backup
27 27
28 project=$(composeGetProject) 28 project=$(composeGetProject)
29 29
30 IRN=$(docker-compose exec -T $container psql --username=postgres --dbname=$container -t -c 'select irn from organization')
31 ##Trim function in postgres didn't work - so take out the extra space this way.
32 IRN=`echo $IRN | sed -e 's/^[[:space:]]*//'`
33
30 echo "Project is $project" 34 echo "Project is $project"
31 echo "Container is $container" 35 echo "Container is $container"
32 echo "Remote target is $remoteTarget" 36 echo "Remote target is $remoteTarget"
33 echo "Username is $userName" 37 echo "Username is $userName"
38 echo "IRN is $IRN"
34 39
35 backupFile=./backup/${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup 40 backupFile=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup
36 backupFile2=./backup/${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).directorycontents.tar.gz 41 backupFile2=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).directorycontents.tar.gz
37 42
38 43
39 if [ "$project" == "" ]; then 44 if [ "$project" == "" ]; then
40 echo "no project available" 45 echo "no project available"
41 exit 1 46 exit 1
53 gzip ${backupFile} 58 gzip ${backupFile}
54 59
55 echo "completed backup of $container for $project to ${backupFile}" 60 echo "completed backup of $container for $project to ${backupFile}"
56 61
57 #backup of all files in current directory 62 #backup of all files in current directory
58 tar -czf ${backupFile2} . --exclude=./backup 63 #tar -czf ${backupFile2} . --exclude=./backup
64 tar --exclude=./backup -czf ${backupFile2} .
59 65
60 echo "completed backup of all files for $project to ${backupFile2}" 66 echo "completed backup of all files for $project to ${backupFile2}"
61 67
62 68
63 # 69 #