From e68a7d7b8a0a127bf1a78fa9d2b12fac22b916c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Fabr=C3=A9gat?= Date: Wed, 17 Jul 2024 23:42:34 +0200 Subject: [PATCH] adds timestamp to filename / adds --no-tablespaces --- run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index 34640f7..d17c1ca 100644 --- a/run.sh +++ b/run.sh @@ -1,10 +1,12 @@ #!/bin/bash +timestamp=$(date -u +"%Y-%m-%dT%H%M%SZ") + # Dump MySQL database -mysqldump -h $MYSQL_HOST -P $MYSQL_PORT -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > /tmp/$MYSQL_DATABASE.sql | gzip -c > /tmp/$MYSQL_DATABASE.sql.gz +mysqldump -h $MYSQL_HOST -P $MYSQL_PORT -u $MYSQL_USER -p$MYSQL_PASSWORD --no-tablespaces $MYSQL_DATABASE > /tmp/$MYSQL_DATABASE.sql | gzip -c > /tmp/$MYSQL_DATABASE.sql.gz # Upload to S3 -aws s3 cp /tmp/$MYSQL_DATABASE.sql.gz s3://$S3_BUCKET$S3_PREFIX$MYSQL_DATABASE.sql.gz +aws s3 cp /tmp/$MYSQL_DATABASE.sql.gz s3://$S3_BUCKET$S3_PREFIX${timestamp}.sql.gz # Remove dump rm /tmp/$MYSQL_DATABASE.sql.gz \ No newline at end of file