September 2, 20196 yr 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.
September 2, 20196 yr 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?
September 2, 20196 yr Author 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.
Archived
This topic is now archived and is closed to further replies.