Backup WP Site

RankBuilder

BANNED
Joined
Sep 6, 2020
Messages
99
Reaction score
15
Does the Export thin in Wordpress Tool backups everything? Including the designs and modification you made to the theme?
 
If you have a VPS, you will not need a plugin for this atall.

To backup the files (you will need zip installed on your linux), run:
Code:
zip -r  /var/backups/files/backup-"`date +"%d-%m-%Y"`".zip /var/www/sitefolder

where /var/backups/files/ is the folder name for your backup and /var/www/sitefolder is the folder of your site. This will save the zip files in the following format: backup-01-10-2020.zip

To backup your mysql db, run:
Code:
mysqldump -u username -p your_wp_dbname > /var/backups/db/backup-"`date +"%d-%m-%Y"`".sql

Where your_wp_dbname is the name of the database, and /var/backups/db is the folder where your db backups will be saved.

The good part about this is the fact that you can put these two commands inside a shell script, and run it automatically through crontab, every x days. It's pretty much set and forget. If you are running out of space due to many backup files being stored, you can also delete old backups automatically. To do that, put the following command in that same shell script:
Code:
find /var/backups/files/ -mindepth 1 -mtime +15 -delete
find /var/backups/db/ -mindepth 1 -mtime +15 -delete

This will delete all backups from your db and files folder that is older than 15 days.

An alternative way to do this is through git, but that's out of the question if your site is big, and does not have a git repo.
 
Back
Top