explosionhole Posted February 15, 2023 Share Posted February 15, 2023 I have installed the user.scripts plugin, which is very useful, and have copied across a backup script (originally written for MySQL, but reusing here for my new MariaDB docker container). It errors with: /tmp/user.scripts/tmpScripts/mariadb-backup/script: line 11: mysqldump: command not found Under which environment and user is this executing? I am assuming on the Unraid's OS itself and as `root`. Quote Link to comment
trurl Posted February 15, 2023 Share Posted February 15, 2023 1 hour ago, explosionhole said: Under which environment and user is this executing? I am assuming on the Unraid's OS itself and as `root`. Yes. Unraid isn't going to have that command, and likely it is missing a lot of dependencies even if you could install the command. Maybe it would run in your mariadb container. You can get to the command line inside a container by clicking its icon and selecting >_ Console. If you can get it working inside that container, then it should be possible to make User Scripts run it inside that container. Quote Link to comment
explosionhole Posted February 15, 2023 Author Share Posted February 15, 2023 thanks for the pointer. when selecting the deployed Mariadb-Official container, so view it's config it actually lists a command to perform backups, which they have as: docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql Which I tried, by adding a new "bind" volume to the container's config and pointing the paths. Now I get "permission denied", presumably the local user this is running as within this container doesn't have permissions to my new "bind" volume. I cannot identify which user I am on the container's console. docker exec mariadb sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD" | gzip > /backups/unraid_`date '+%d-%m-%Y'`.sql.gz' Quote Link to comment
trurl Posted February 15, 2023 Share Posted February 15, 2023 3 minutes ago, explosionhole said: docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql This command is for running on Unraid. It executes a command in the container and sends the results to a path on Unraid. Quote Link to comment
explosionhole Posted February 15, 2023 Author Share Posted February 15, 2023 1 hour ago, trurl said: This command is for running on Unraid. It executes a command in the container and sends the results to a path on Unraid. I know this. What I don't (off-hand) understand is the user and permission model for Unraid with Docker containers. If this was a pure Docker (or other container platform), I would use newer "volumes" not "bind volumes". However, adopting to a new platform, I am trying to follow the typical patterns that follows the Unraid GUI. Quote Link to comment
Solution explosionhole Posted February 15, 2023 Author Solution Share Posted February 15, 2023 I deleted all of the mounts and directories on the Unraid server and inside the MariaDB container too. Then recreated it, and seems to be working as above. Not sure which permission was causing the issue, might have been the first output file and afterwards the script would need to update an existing file. 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.