Created
April 2, 2021 14:39
-
-
Save mattbloomfield/cf80a3e3487651e04dd7305ca8e8562d to your computer and use it in GitHub Desktop.
Saves the local DB to a file. If not supplied with a path, stored in /tmp/ with current timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Saves the local DB to a file. If not supplied with a path, stored in /tmp/ with current timestamp | |
## Usage: fin db_dump [path] | |
# Forces whole job to error on failure | |
set -e | |
TRANSACTION_ID=$(date +"%Y-%m-%d_%H-%M-%S") | |
SAVE_PATH=$1 | |
if [ $# -eq 0 ] | |
then | |
SAVE_PATH=/tmp/${MYSQL_DATABASE}_local_${TRANSACTION_ID}.sql | |
fi | |
fin db dump $SAVE_PATH | |
echo "Saved as ${SAVE_PATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment