From 832daabf66d282550b1dab26434f456ab84016ab Mon Sep 17 00:00:00 2001 From: bkoschicek Date: Mon, 27 Nov 2023 13:16:03 +0100 Subject: [PATCH] fix backup paths --- install/backup_script.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install/backup_script.sh b/install/backup_script.sh index c78ed7167..6dc6c0b1f 100755 --- a/install/backup_script.sh +++ b/install/backup_script.sh @@ -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