Skip to content

Conversation

@caos30
Copy link

@caos30 caos30 commented Oct 18, 2022

Hi. Thanks for this extremely simple and useful script. I modified 2 lines on the script to be able to use the DB_HOST parameter defined on wp-config.php 😉

Indeed, i also needed to add some way to define a list of ONLY-INCLUDED sub-directories and files when backing up the Home directory. Because my subdomains are stored on sub-directories of the main domain name (is a default setting on my hosting) so... i need a way to exclude such directories when backing up the main WP site. Well, even is usual to have another directories not used by WP... so i would like to define a list of EXCLUDED directories.

Also, one of my WP sites has a Home Directory VERY HEAVY (about 7.5Gb of photos and videos) and then i choosed to add the option in the profile of NOT-USE COMPRESSED-TAR files. When you set this parameter then the result are 2 files per daily backup of a site: 1) db.sql.gz + 2) FILES.tar

The save of time is almost 10 times comparing to use compressed TAR files! And the size of the backup is not more bigger than 20-35% So at least in my case i prefer be faster and heavier than slower and smaller.

Cheers!
Sergi

Hi. Thanks for this extremely simple and useful script. I modified 2 lines on the script to be able to use the DB_HOST parameter defined on wp-config.php ;-)

Cheers!
Sergi
In certain hosting configurations i have a wordpress site in the document root of the domain name and i have in subdirectories other sites belonging to subdomains of the same domain name. So i need to backup only the index.php file and the wp-* directories and files of the root directory. Furthermore, i usually have other directories storing other data in the same root directory of the main WP site...

This change in the SH script need an optional new parameter called file_list in the profile file for the wp site. Something like this:

file_list="wp-* favicon.ico index*"

if you comment this file then the default behaviour of the script is the same until now: backup all the directories and files inside the document root (wp_root parameter on the profile file).
This is the change required on the profile to be able to backup only some files/directories on the wp_root path.
I'm sorry, because i've needed to refactor my 2 previous commits. But finally it save almost 10 times the time needed to make a backup of about 7Gb of space. The solution was not only not merge the DB backup with the backup of the Home directory, but also NOT COMPRESS that Home directory copy. So instead of get a compressed TAR.GZ of the Home Directory we get a TAR file containing the Home Directory (or the files and subdirectories you specify in the profile).

Furthermore, when you specify not to compress i choosed to not to join both copies (DB + HOME DIR) and leave it as 2 different files per daily backup. At least for me has another advantage: i can get a copy of the database without decompress the daily backup.

My change introduced in this commit needs this in the profile (i will commit it in the next commit):

# Optional: if your files & directories to be backed up are too bigger in size, you can set this to false
# and then that backup will not be compressed and the the daily backup were composed by 2 files (SQL.GZ for DB and TAR for files&dirs)
compressed_tar_file=false
This new OPTIONAL parameter is to make run my other previous commit, to get 2 FILES each day per WP site backed up (instead a unique compressed TAR.GZ), and the one containing the Home Directory is not compressed (so it is a TAR file, not TAR.GZ) and it save almost 10 times of processing time for a Home directory of about 7Gb with a lot of videos an photos. 

The resulting TAR file is maybe 20-35% bigger, but i prefer to get it faster than smaller. Space is not so a problem.
@caos30 caos30 changed the title Use the DB_HOST parameter on wp-config to run mysqldump database Use the DB_HOST parameter on wp-config to run mysqldump database & disable COMPRESSION for HomeDirectory & limit backup to certain sub-directories and files Oct 18, 2022
@pothi
Copy link

pothi commented Dec 2, 2022

Good idea(s). Do you use cPanel, btw?

@caos30
Copy link
Author

caos30 commented Dec 2, 2022

Nop. It's a tailored hosting panel, made by my hosting provider. Why do you ask for this?

@pothi
Copy link

pothi commented Dec 3, 2022

Thanks for clarifying. Just curious about your use-case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants