Skip to content

Commit

Permalink
fix docker execution (TTY error)
Browse files Browse the repository at this point in the history
related to #5

On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
	modified:   backup-docker-mysql.sh
  • Loading branch information
alaub81 committed Oct 31, 2023
1 parent 15fbbe9 commit f5d6d9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backup-docker-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ for i in $CONTAINER; do
MYSQL_DATABASE=$(docker exec $i env | grep MYSQL_DATABASE |cut -d"=" -f2)
MYSQL_PWD=$(docker exec $i env | grep MYSQL_ROOT_PASSWORD |cut -d"=" -f2)
# check for dump method
if docker exec -it $i test -e /usr/bin/mysqldump; then
if docker exec $i test -e /usr/bin/mysqldump; then
echo -e " create MYSQL Backup for Database on Container:\n * $MYSQL_DATABASE DB on $i";
docker exec -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_PWD=$MYSQL_PWD \
$i /usr/bin/mysqldump -u root $MYSQL_DATABASE \
| gzip > $BACKUPDIR/$i-$MYSQL_DATABASE-$TIMESTAMP.sql.gz
elif docker exec -it $i test -e /usr/bin/mariadb-dump; then
elif docker exec $i test -e /usr/bin/mariadb-dump; then
echo -e " create MariaDB Backup for Database on Container:\n * $MYSQL_DATABASE DB on $i";
docker exec -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_PWD=$MYSQL_PWD \
$i /usr/bin/mariadb-dump -u root $MYSQL_DATABASE \
Expand Down

0 comments on commit f5d6d9e

Please sign in to comment.