# HG changeset patch # User aldrich@ssdt-ohio.org # Date 1572529202 -3600 # Node ID 2cb1093f9aef7570e6c3017be42d723b0e123c64 # Parent 58c49a386a11d271d9e0224826bdf9b08ab55d26 making changes to remote backup scripts to account for no IRN diff -r 58c49a386a11 -r 2cb1093f9aef scripts/backup-container.sh --- a/scripts/backup-container.sh Thu Oct 31 14:34:53 2019 +0100 +++ b/scripts/backup-container.sh Thu Oct 31 14:40:02 2019 +0100 @@ -17,6 +17,13 @@ project=$(composeGetProject) +#If the project is empty, we want to stop the process because this is being run from the wrong directory + +if [ "$project" == "" ]; then + echo "no project available" + exit 1 +fi + set -o pipefail mkdir -p ./backup ## @@ -33,18 +40,15 @@ backupFile=./backup/${IRN}${project}-${container}.$(date +%Y-%m-%d-%H-%M-%S).backup -echo "IRN${IRN}" +echo "Project is $project" +echo "Container is $container" +echo "IRN is $IRN" echo "backup file ${backupFile}" echo "preparing to backup ${container} on current project at ${projectDir}:" echo " " -#If the project is empty, we want to stop the process because this is being run from the wrong directory -if [ "$project" == "" ]; then - echo "no project available" - exit 1 -fi echo "starting backup of $container for $project" docker-compose exec -T $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile} diff -r 58c49a386a11 -r 2cb1093f9aef scripts/remote-backup.sh --- a/scripts/remote-backup.sh Thu Oct 31 14:34:53 2019 +0100 +++ b/scripts/remote-backup.sh Thu Oct 31 14:40:02 2019 +0100 @@ -27,6 +27,13 @@ project=$(composeGetProject) +#If the project is empty, we want to stop the process because this is being run from the wrong directory +if [ "$project" == "" ]; then + echo "no project available" + exit 1 +fi + + 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:]]*//'` @@ -43,14 +50,11 @@ echo "Username is $userName" echo "IRN is $IRN" + 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 the project is empty, we want to stop the process because this is being run from the wrong directory -if [ "$project" == "" ]; then - echo "no project available" - exit 1 -fi + echo "starting backup of $container for $project" docker-compose exec -T $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile}