Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.0 KiB

  1. #!/bin/bash
  2. ### DO NOT EDIT THIS FILE
  3. source "$(dirname "${BASH_SOURCE[0]}")/../../includes/includes.sh"
  4. app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." &> /dev/null && pwd)
  5. source "$app_dir/etc/config.sh"
  6. env=$(getArgument $1 "Usage: link_latest_db.sh [live|stage]" "live stage")
  7. echo
  8. echoMainTitle "Set $env system latest databases links"
  9. files=($(ls -t | head -1))
  10. date=$("${files[0]}" | sed -e "s/(\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2}).*/\1/")
  11. struct_file="${date}_${env}_structure.sql.gz"
  12. data_file="${date}_${env}_data.sql.gz"
  13. gdpr_file="${date}_${env}_gdpr_data.sql.gz"
  14. if [ -f "$struct_file" ]; then ln -s "$struct_file" "$app_dir/var/latest/${env}_structure.sql.gz"; fi
  15. if [ -f "$data_file" ]; then ln -s "$data_file" "$app_dir/var/latest/${env}_data.sql.gz"; fi
  16. if [ -f "$gdpr_data_file" ]; then ln -s "$gdpr_data_file" "$app_dir/var/latest/${env}_gdpr_data.sql.gz"; fi
  17. echoFinal "... latest databases linked"
  18. echo "Running postscript ..."
  19. postScript "$app_dir/bin/postscripts/functions/set_latest_db.sh"