Skip to content

Commit

Permalink
fix backup paths
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Nov 27, 2023
1 parent 21c7d7d commit 832daab
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions install/backup_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purposes

if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root. Aborting."
exit 1
fi


export DB_URL="postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB"
mkdir -p $1
pg_dump ${DB_URL} > $1/$(date '+%Y-%m-%d_%H%M')_export_${POSTGRES_DB}.sql

cp -r -u -v /var/www/openatlas/files/uploads/ $1/uploads/
cp -r -u -v /var/www/openatlas/files/processed_images/ $1/processed_images/
cp -r -u -v /var/www/openatlas/files/export/ $1/export/

cp -r -u -v /var/www/openatlas/files/uploads/ $1
cp -r -u -v /var/www/openatlas/files/processed_images/ $1
cp -r -u -v /var/www/openatlas/files/export/ $1

chown -R www-data:www-data $1

0 comments on commit 832daab

Please sign in to comment.