Install mysqldump (MariaDB or mysql client?) to the Unraid OS for user script


Go to solution Solved by explosionhole,

Recommended Posts

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`.

 

Link to comment
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.

Link to comment

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'

 

 

Link to comment
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.

 

 

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.