#!/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/backup/ else echo "Backup to failed" exit 1 fi