Skip to content
WPNETPublic

About

Site-agnostic WordPress backup & restore utility for SpinupWP servers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

WP Backup

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.

Features

  • 📦 DB + Files Backup: Export the database and archive WordPress files independently or together
  • 🎯 Zero Configuration: Auto-detects DOMAIN (from $HOME), WP_ROOT (from wp-cli.yml or wp-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 with wp-backup conf
  • 🖥️ Interactive Menu: Simple numbered menu — no flags to remember

Requirements

  • Ubuntu (SpinupWP server)
  • WP-CLI (/usr/local/bin/wp or on PATH)
  • tar, gzip, ionice, nice (standard on Ubuntu)

Installation

sudo git clone https://github.com/WPNET/wp-backup.git /opt/wp-backup
cd /opt/wp-backup
sudo chmod 700 wp-backup.sh install.sh

Install 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 user

Important: Run wp-backup itself as the site user, never as root.

Usage

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.

Excluding paths from file backups

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

About

Site-agnostic WordPress backup & restore utility for SpinupWP servers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages