From e33b934cb0ca91fd059f48eb418b19c0de82ed4c Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 16 Apr 2024 16:19:54 +0200 Subject: [PATCH] export content script 5 --- utils/export-content.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/export-content.sh b/utils/export-content.sh index 12cf904..e0292f8 100644 --- a/utils/export-content.sh +++ b/utils/export-content.sh @@ -20,11 +20,12 @@ if [[ "$answer" == "y" ]]; then site_name=$(ls /var/www/repositories/ | grep -v '^cms') db_password=$(cat /var/www/repositories/cms*/.env | grep DB_PASSWORD | sed "s/[^']*'\([^']*\)'.*/\1/") current_date=$(date +'%d-%m-%y_%H-%M') - export_folder="/home/val/content_exports/${site_name}_export_${current_date}" + export_base_folder="/home/${user}/content_exports" + export_folder="${export_base_folder}/${site_name}_export_${current_date}" mkdir -p "${export_folder}" mysqldump -u directus -p"${db_password}" directus > "${export_folder}/db_${site_name}_${current_date}" cp -r /var/www/repositories/cms*/uploads "${export_folder}" - tar -czf "${export_folder}.tar.gz" -C /root/content_exports/ . + tar -czf "${export_folder}.tar.gz" -C "${export_base_folder}" . chown -R "${user}:${user}" "${export_folder}" ssh_port=$(cat /etc/ssh/sshd_config | grep "Port " | sed 's/^Port //')