Merge pull request #900 from mailcow/dev

[Helper] Use proper names for volume and container name filters
master
André Peters 2018-01-14 20:56:20 +01:00 committed by GitHub
commit a343c62966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -57,33 +57,33 @@ function backup() {
vmail|all) vmail|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=vmail):/vmail \ -v $(docker volume ls -qf name=vmail-vol-1):/vmail \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_vmail.tar.gz /vmail debian:stretch-slim /bin/tar -cvpzf /backup/backup_vmail.tar.gz /vmail
;;& ;;&
redis|all) redis|all)
docker exec $(docker ps -qf name=redis) redis-cli save docker exec $(docker ps -qf name=redis-mailcow) redis-cli save
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=redis):/redis \ -v $(docker volume ls -qf name=redis-vol-1):/redis \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_redis.tar.gz /redis debian:stretch-slim /bin/tar -cvpzf /backup/backup_redis.tar.gz /redis
;;& ;;&
rspamd|all) rspamd|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=rspamd):/rspamd \ -v $(docker volume ls -qf name=rspamd-vol-1):/rspamd \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_rspamd.tar.gz /rspamd debian:stretch-slim /bin/tar -cvpzf /backup/backup_rspamd.tar.gz /rspamd
;;& ;;&
postfix|all) postfix|all)
docker run --rm \ docker run --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
-v $(docker volume ls -qf name=postfix):/postfix \ -v $(docker volume ls -qf name=postfix-vol-1):/postfix \
debian:stretch-slim /bin/tar -cvpzf /backup/backup_postfix.tar.gz /postfix debian:stretch-slim /bin/tar -cvpzf /backup/backup_postfix.tar.gz /postfix
;;& ;;&
mysql|all) mysql|all)
SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' ${COMPOSE_FILE}) SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' ${COMPOSE_FILE})
docker run --rm \ docker run --rm \
--network $(docker network ls -qf name=mailcow) \ --network $(docker network ls -qf name=mailcow) \
-v $(docker volume ls -qf name=mysql):/var/lib/mysql/ \ -v $(docker volume ls -qf name=mysql-vol-1):/var/lib/mysql/ \
--entrypoint= \ --entrypoint= \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \ -v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup \
${SQLIMAGE} /bin/sh -c "mysqldump -hmysql -uroot -p${DBROOT} --all-databases | gzip > /backup/backup_mysql.gz" ${SQLIMAGE} /bin/sh -c "mysqldump -hmysql -uroot -p${DBROOT} --all-databases | gzip > /backup/backup_mysql.gz"