hawihoney Posted September 2, 2019 Share Posted September 2, 2019 I do have MariaDB running in a docker container. I would like to take a backup of all databases every night with the help of the user scripts plugin. Whatever I try, it doesn't work. This is the last iteration of my tests. If I call it from the console it works perfect. Running from user scripts fails: docker exec mariadb /usr/bin/mysqldump --user=root --password=******** nextcloud > /mnt/user/data/mariadb_backup/nextcloud/dump.sql Here's the complete MariaDB/Nextcloud backup script with the failing line: #!/bin/bash #arrayStarted=true #clearLog=true #noParity=true docker stop nextcloud docker stop mariadb rsync -avPX --delete-during /mnt/cache/system/appdata/mariadb/ /mnt/user/data/appdata_backup/mariadb/ rsync -avPX --delete-during /mnt/cache/system/appdata/nextcloud/ /mnt/user/data/appdata_backup/nextcloud/ rsync -avPX --delete-during /mnt/cache/NextCloud/ /mnt/user/data/nextcloud_backup/ rsync -avPX --delete-during /mnt/cache/NextCloud/hawi/files/.Contacts-Backup/ /mnt/user/data/nextcloud/contacts/ docker start mariadb docker start nextcloud # Does not work # docker exec mariadb /usr/bin/mysqldump --user=root --password=******** nextcloud > /mnt/user/data/mariadb_backup/nextcloud/dump.sql I even tried to but "sudo" in front of it - no joy. I'm out of ideas. Is there really no way to take a backup of a MariaDB database with user scripts? Many thanks in advance. Quote Link to comment
BRiT Posted September 2, 2019 Share Posted September 2, 2019 Probably a timing issue, you're trying to run cmds in mariadb before its fully started after it was stopped then started? Try putting docker exec before you stop the containers? Quote Link to comment
hawihoney Posted September 2, 2019 Author Share Posted September 2, 2019 OMG, it was that easy. Had to put "sleep 5s" in script between docker start (mariadb, nextcloud) and before calling mysqldump. Thank you very much. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.