[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: 303
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 » Wed Jan 03, 2018 6:26 am

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 » Wed Jan 03, 2018 6:47 pm

The error sounds new.
Mobile app development company

User avatar
fribse
Experience counts
Posts: 2076
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 » Wed Jan 03, 2018 9:40 pm

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: 303
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 » Wed Jan 03, 2018 9:59 pm

Strange... it‘s all 777 and admin/administrator in the shell

User avatar
Trexx
Experience counts
Posts: 4903
Joined: Sat Oct 01, 2011 7:50 am
Location: Minnesota
Contact:

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

Post by Trexx » Wed Jan 03, 2018 11:06 pm

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.4.1.x
QTier (HDD): [RAID-5] 6 x 3TB HGST DeskStar NAS QTier (SSD): [RAID-1] 2 x 1TB WD Blue m.2's
(SSD): [RAID-1] 2 x 500GB Evo 860
RAM: Kingston HyperX Fury 64GB DDR4-2666
GPU: EVGA GTX 1060, ACX 2.0(1 Fan), 6GB
UPS: CyberPower AVR1350 Ext. Backup: USB 3.0 Seagate 5TB
Media Boxes: Nvidia ShieldTV Pro, AppleTV 4k, Various Roku's

Model: TVS-673 32GB FW: 4.4.1.x Test/Backup Box
-----------------------------------------------------------------------------------------------------------------------------------------
NAS RAID Rebuild Times | Live QTS Videos | | QNAP NAS Guide | Information needed when you ask for HELP | QNAP Links, Tutorials, etc.
2018 Plex NAS Compatibility Guide | QNAP Plex FAQ | Moogle's QNAP Faq

trendchiller
Easy as a breeze
Posts: 303
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 » Thu Jan 04, 2018 5:00 am

No Optware / Entware or else :-/

User avatar
fribse
Experience counts
Posts: 2076
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 » Thu Jan 04, 2018 2:30 pm

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: 303
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 » Fri Jan 05, 2018 6:12 am

Yes

User avatar
fribse
Experience counts
Posts: 2076
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 » Sun Jan 07, 2018 6:44 pm

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: 303
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 » Mon Jan 08, 2018 4:49 am

No own installations of anything :-(
I‘m running 4.3.4 b0435 (latest)
I‘m also out of ideas...

uwe_k
New here
Posts: 6
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 » Sun Jan 14, 2018 9:00 pm

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: 303
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 » Sun Jan 21, 2018 5:19 am

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: 2076
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 » Wed Jan 24, 2018 2:15 pm

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 » Tue May 08, 2018 9:33 am

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: 2076
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 » Mon Jun 04, 2018 3:59 am

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)”