From bad33dd549d77cf17e5b42c67626f627ae501ab3 Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 16 Apr 2024 16:06:18 +0200 Subject: [PATCH] export content script 2 --- utils/export-content.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/export-content.sh b/utils/export-content.sh index 6f9c055..ac4d3b6 100644 --- a/utils/export-content.sh +++ b/utils/export-content.sh @@ -18,14 +18,14 @@ 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="/root/content_exports/${site_name}_export_${date}" + export_folder="/root/content_exports/${site_name}_export_${current_date}" mkdir -p "${export_folder}" - mysqldump -u directus -p"${db_password}" directus > "${export_folder}/db_${site_name}_${date}" + 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 "/root/content_exports/${export_folder}.tar.gz" -C /root/content_exports/ . ssh_port=$(cat /etc/ssh/sshd_config | grep "Port " | sed 's/^Port //') ip=$(hostname -I) echo -e "${PURPLE}${BOLD}You can now download the backup${RESET}" - echo -e "${BLUE}scp -P ${ssh_port} root@${ip}:/root/content_exports/${export_folder}.tar.gz ./path/to/local/folder${RESET}" + echo -e "${BLUE}scp -P ${ssh_port} root@${ip}:${export_folder}.tar.gz ./path/to/local/folder${RESET}" fi \ No newline at end of file