server/configs/mysql_backup.sh

10 lines
333 B
Bash
Raw Normal View History

2019-01-17 08:26:51 +00:00
#!/bin/sh
[ -z "${MYSQL_PASSWORD}" ] && [ -n "${MYSQL_PASSWORD_FILE}" ] && MYSQL_PASSWORD=$(cat "${MYSQL_PASSWORD_FILE}" | tr -d '\n')
2019-01-17 08:26:51 +00:00
while true
do
sleep 360
mysqldump -h "${MYSQL_HOST}" -u "${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" | gzip > /var/lib/fic/backups/db-$(date +%Y%m%d%H%M).sql.gz
done