Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How call mysqldump (MariaDB) from user scripts?

Featured Replies

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.

 

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?

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.