https://github.com/tanrax/wp-backup
Snapshot and backups for WordPress in pure Bash
https://github.com/tanrax/wp-backup
backup bash database restore shell wordpress
Last synced: 4 months ago
JSON representation
Snapshot and backups for WordPress in pure Bash
- Host: GitHub
- URL: https://github.com/tanrax/wp-backup
- Owner: tanrax
- License: gpl-3.0
- Created: 2020-05-31T13:04:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-29T14:55:57.000Z (over 3 years ago)
- Last Synced: 2025-04-11T04:34:03.992Z (6 months ago)
- Topics: backup, bash, database, restore, shell, wordpress
- Language: Shell
- Homepage:
- Size: 318 KB
- Stars: 22
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Snapshot and backups for WordPress in pure Bash
![]()
Create **backups or restores on your WordPress** using a **simple Bash script** and don't rely on plugins or WP-CLI.
Why should I use it?
- Easy.
- Very fast.
- Multi-site compatible.
- Docker compatible.
- Working with cron and any unix utility.
- Maintains settings, plugins and any important elements.
- Compatible with Linux, MacOS and BSD.## Use
### Backup ⬇️ 📁 ➕ ⬇️ 📓
Create a zip file with important files and backup of the database.
``` shell
./wp-backup.sh backup-all
```### Backup only database ⬇️ 📓
``` shell
./wp-backup.sh backup-database
```### Restore only files ⬇️ 📁
``` shell
./wp-backup.sh restore-files [{backup}.zip]
```### Restore only database ⬆️ 📓
``` shell
./wp-backup.sh restore-database [{database}.sql]
```### Restore files and database ⬆️ 📁 ➕ ⬆️ 📓
``` shell
./wp-backup.sh restore-all [{backup}.zip]
```### Check the connection to the database ✅ 📓
``` shell
./wp-backup.sh check-database
```### Connection to the database 🔌 📓
``` shell
./wp-backup.sh connect-to-database
```## Requirements
- **bash** 4.0 or higher
- **curl**
- **zip**
- Only macOS users, **gsed**: `brew install gnu-sed`## Install
Go to the WordPress directory (Where are all the files and folders like wp-admin, wp-config, wp-content ...).
``` shell
cd wordpress-folder
```Download script.
``` shell
curl -o wp-backup.sh https://raw.githubusercontent.com/tanrax/wp-backup/master/wp-backup.sh
```Grant execute permissions.
``` shell
sudo chmod +x wp-backup.sh
```Run.
``` shell
./wp-backup.sh
```## Are you using Docker?
Enter the container with bash. For example `wordpress_web_1`.
``` shell
docker exec -it wordpress_web_1 bash
```You will need to enter the WordPress container and install a minimum of unix commands.
- `zip`
- `unzip`
- `mariadb-client```` shell
apt update && apt install -y mariadb-client zip unzip
```Run `wp-backup.sh` inside container.
``` shell
./wp-backup.sh
```## Disclaimer
The author is not responsible for any loss of information or side effects. Use at your own risk.