[HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.8

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

might it be that the script ist not run in "admin" context ?
no hard / softlinks are used in the storage path.
I also got now: MySQL Backup: ERROR ereasing old montly backups
when run in ssh as admin it works again...
i'm out of ideas...
Expert Developer
New here
Posts: 2
Joined: Tue Dec 19, 2017 4:54 pm
Location: New York
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by Expert Developer »

The error sounds new.
Mobile app development company
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by fribse »

Crontab on qnap is run as root, so that shouldn't be a problem.
But it sounds like some filerights have gone wrong, both with the failure to delete old archives, and the backup files when creating an archive.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

Strange... it‘s all 777 and admin/administrator in the shell
User avatar
Trexx
Ask me anything
Posts: 5393
Joined: Sat Oct 01, 2011 7:50 am
Location: Minnesota

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by Trexx »

Do you have Entware/Optware/etc. installed? I have run into issues where some of there "commands" which duplicate QTS commands behave differently. You could try disabling that QPKG, reboot to be safe, and then see if you see the same behavior.
Paul

Model: TS-877-1600 FW: 4.5.3.x
QTS (SSD): [RAID-1] 2 x 1TB WD Blue m.2's
Data (HDD): [RAID-5] 6 x 3TB HGST DeskStar
VMs (SSD): [RAID-1] 2 x1TB SK Hynix Gold
Ext. (HDD): TR-004 [Raid-5] 4 x 4TB HGST Ultastor
RAM: Kingston HyperX Fury 64GB DDR4-2666
UPS: CP AVR1350

Model:TVS-673 32GB & TS-228a Offline[/color]
-----------------------------------------------------------------------------------------------------------------------------------------
2018 Plex NAS Compatibility Guide | QNAP Plex FAQ | Moogle's QNAP Faq
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

No Optware / Entware or else :-/
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by fribse »

Are the rights on the parent folder also 777?
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

Yes
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by fribse »

I really have no idea on this, anybody else that has a good suggestion?
You don't have you own installation of tar, mysql, mariasql or anything, right?
Are you running any other software that can change the existing built-in software on the nas?
What firmware is it running?
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

No own installations of anything :-(
I‘m running 4.3.4 b0435 (latest)
I‘m also out of ideas...
User avatar
uwe_k
Starting out
Posts: 19
Joined: Sun Dec 15, 2013 3:55 am

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by uwe_k »

Hello,

could it be that the script can not find some needed binaries (PATH is not set correctly)?

Tschau
Uwe
Last edited by uwe_k on Sun Jan 21, 2018 5:58 am, edited 1 time in total.
trendchiller
Easy as a breeze
Posts: 309
Joined: Sun Nov 29, 2009 6:43 pm
Location: Germany

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by trendchiller »

How to find this out ?
maybe some sript to execute by cron that writes it to some file ?
Last edited by trendchiller on Wed Jan 24, 2018 5:43 pm, edited 1 time in total.
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by fribse »

As far as I can see all commands have full paths, as a CRON job does not use the standard environment.
But it could be interesting to see if they are the same.
The commands are defined as variables in the top of the script, maybe compare them to what is reported if you write 'which XX' on the command line?
Eg. the command rm, it is defined to be at /bin/rm, and if you write "which rm" it reports /bin/rm

The only commands defined elsewhere is mysqldump and mysql, that is defined in the section # Check for mysqldump command and # Check for mysql command

Those could be saved to files by adding these lines after the two sections.
$ec_c $mysqld_c > /share/Public/mysqld_c.txt
$ec_c $mysqld_p > /share/Public/mysqld_p.txt
$ec_c $mysqlc_c > /share/Public/mysqlc_c.txt
$ec_c $mysqlc_p > /share/Public/mysqlc_p.txt

That will produce the four files in /share/Public, and they should show something like:
[/share/Public] # cat mysqld_p.txt
/share/MD0_DATA/.qpkg/Optware
[/share/Public] # cat mysqld_c.txt
/usr/local/mysql/bin/mysqldump -eqQR --single-transaction
[/share/Public] # cat mysqlc_c.txt
/usr/local/mysql/bin/mysql
[/share/Public] # cat mysqlc_p.txt
/share/MD0_DATA/.qpkg/Optware
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
KarlInOz
Starting out
Posts: 11
Joined: Tue Nov 07, 2017 12:03 pm

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by KarlInOz »

Hey @Frisbe thanks heaps for the script, another happy camper here. Installed and ran flawlessly first time.
Model:TS-453 Pro
Current firmware version:4.3.6.0993
User avatar
fribse
Experience counts
Posts: 2090
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
Contact:

Re: [HOWTO] Make automatic backup of ALL MySQL / MariaSQL databases on QNAP V3.7

Post by fribse »

Good to hear :-) Thanks!
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628

NAS-659 Pro II (3 GB Ram), Raid1, Survailance station, local backup destination + NAS-853A (16 GB Ram), Virtualization Station, Plex, iDrive
Network: Fritz!Box 7560 + 24p SG200 + 2x8p SG200 + 8p POE EdgeCore + 300/300 mbit Internet
Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”