OKR/build-image/mysql/entrypoint.sh

11 lines
335 B
Bash
Executable File

#!/bin/bash
datetime=`date +%Y%m%d%H`
mysqldump -h ${HOST} -P ${PORT} -u backup -p${PASSWORD} --single-transaction --set-gtid-purged=OFF --all-databases > bfs-application-${datetime}.sql
if (($?==0));then
aws s3 cp bfs-application-${datetime}.sql s3://bfs-pkg-storage/mysql/history/
else
echo "Backup to failed"
exit 1
fi