export content script 5

This commit is contained in:
Valentin 2024-04-16 16:19:54 +02:00
parent ac82aa949e
commit e33b934cb0
1 changed files with 3 additions and 2 deletions

View File

@ -20,11 +20,12 @@ if [[ "$answer" == "y" ]]; then
site_name=$(ls /var/www/repositories/ | grep -v '^cms') site_name=$(ls /var/www/repositories/ | grep -v '^cms')
db_password=$(cat /var/www/repositories/cms*/.env | grep DB_PASSWORD | sed "s/[^']*'\([^']*\)'.*/\1/") db_password=$(cat /var/www/repositories/cms*/.env | grep DB_PASSWORD | sed "s/[^']*'\([^']*\)'.*/\1/")
current_date=$(date +'%d-%m-%y_%H-%M') 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}" mkdir -p "${export_folder}"
mysqldump -u directus -p"${db_password}" directus > "${export_folder}/db_${site_name}_${current_date}" mysqldump -u directus -p"${db_password}" directus > "${export_folder}/db_${site_name}_${current_date}"
cp -r /var/www/repositories/cms*/uploads "${export_folder}" 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}" chown -R "${user}:${user}" "${export_folder}"
ssh_port=$(cat /etc/ssh/sshd_config | grep "Port " | sed 's/^Port //') ssh_port=$(cat /etc/ssh/sshd_config | grep "Port " | sed 's/^Port //')