Site-agnostic WordPress backup & restore utility for SpinupWP servers. Auto-detects the domain, WordPress root, and database credentials at runtime — no per-site configuration required.
- 📦 DB + Files Backup: Export the database and archive WordPress files independently or together
- 🎯 Zero Configuration: Auto-detects
DOMAIN(from$HOME),WP_ROOT(fromwp-cli.ymlorwp-load.php), and DB credentials via WP-CLI — nothing hardcoded, nothing stored - ♻️ Safe Restore: Restoring a database automatically snapshots the current one first as a rollback point; restoring files can optionally snapshot current files too
- 🧹 Custom Exclusions: Add paths to
~/wp-backup.conf(one per line) to exclude from file backups — generate a starter file withwp-backup conf - 🖥️ Interactive Menu: Simple numbered menu — no flags to remember
- Ubuntu (SpinupWP server)
- WP-CLI (
/usr/local/bin/wpor onPATH) tar,gzip,ionice,nice(standard on Ubuntu)
sudo git clone https://github.com/WPNET/wp-backup.git /opt/wp-backup
cd /opt/wp-backup
sudo chmod 700 wp-backup.sh install.shInstall for a site user (run as root):
sudo /opt/wp-backup/install.sh
# Interactive prompts will ask:
# 1. Which site? (lists /sites/*/files/ directories)
# Script installed as ~/.local/bin/wp-backup, owned by that site userImportant: Run wp-backup itself as the site user, never as root.
Log in as the site user and run:
wp-backup 1 DB backup Exports and compresses the database to ~/backup/
2 Files backup Archives your WordPress files to ~/backup/
3 DB + Files Full backup — both of the above (recommended)
4 Restore DB Choose a DB backup to restore; current DB is automatically
saved as a rollback snapshot first
5 Restore Files Choose a files backup to restore; optionally snapshot
current files before overwriting
6 Exit
Backups are saved to ~/backup/db_<domain>_<date>.sql.gz and ~/backup/files_<domain>_<date>.tar.gz.
Create ~/wp-backup.conf (see wp-backup.conf.example, or generate one with wp-backup conf) and list one path per line, relative to $HOME, no leading/trailing slashes:
files/wp-content/updraft
files/wp-content/uploads/videos