Files

130 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<h2 align="center">
Snapshot and backups for WordPress in pure Bash
</h2>
<p align="center">
<img src="media/wp-backup-logo.png" alt="logo" width="300">
</p>
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
```
## Contributing
Contributions are welcome! Please see the [contribution guidelines](https://git.andros.dev/andros/contribute) for instructions on how to submit issues or pull requests.
## Disclaimer
The author is not responsible for any loss of information or side effects. Use at your own risk.