Skip to content

Commit

Permalink
Update backup
Browse files Browse the repository at this point in the history
  • Loading branch information
vmpartner committed Aug 21, 2019
1 parent dc26467 commit 98ec00c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bin/backup
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh

set -e

now=$(date +"%s_%Y-%m-%d")
/usr/bin/mysqldump --opt -h ${MYSQL_HOST} -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} > "/backup/${now}_${MYSQL_DATABASE}.sql" && \
cd /backup/ && \
gzip ${now}_${MYSQL_DATABASE}.sql && \
curl -T ${now}_${MYSQL_DATABASE}.sql.gz -u ${FTP_USER}:${FTP_PASSWORD} ${FTP_URL} && \
rm -f ${now}_${MYSQL_DATABASE}.sql.gz
rm -f ${now}_${MYSQL_DATABASE}.sql.gz

if [ -z "$CHECK_URL" ]
then
echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor sync job"
else
wget $CHECK_URL -O /dev/null
fi

0 comments on commit 98ec00c

Please sign in to comment.