Skip to content

Instantly share code, notes, and snippets.

@alanfzf
Last active July 27, 2024 17:31
Show Gist options
  • Save alanfzf/2c7622719548c104c8145ec00eea468e to your computer and use it in GitHub Desktop.
Save alanfzf/2c7622719548c104c8145ec00eea468e to your computer and use it in GitHub Desktop.
#!/bin/bash
# System variables
PROFILE=finanssoreal
BUCKET=s3://finanssoreal/database/
OBJECT="$(aws s3 ls --profile $PROFILE $BUCKET | sort | tail -n 1 | awk '{print $4}')"
FULL_PATH="$HOME/$OBJECT"
aws s3 cp "$BUCKET$OBJECT" "$FULL_PATH" --profile $PROFILE
gunzip $FULL_PATH
if [[ "$1" == "-fixsql" ]]; then
FULL_PATH="${FULL_PATH%.gz}"
sed -i 's/DEFINER=`forge`@`%`/DEFINER=`root`@`%`/g' $FULL_PATH
fi
echo "Dump descargado correctamente en $FULL_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment