# RunCloud WordPress Backups

When backing up live WordPress sites on RunCloud (or similar dynamic web roots), files in cache directories (`wp-content/cache`) or session data frequently change during the read phase. 

## 1. The `tar` "file changed" Pitfall
If you run `tar` on a live web root inside a bash script with `set -e`, standard warnings like:
`tar: webapps/<site>/wp-content: file changed as we read it`
will cause `tar` to exit with status 1, immediately terminating the script before the backup completes.

**Solution:**
Either append `|| true` to the `tar` command, or explicitly exclude active cache directories to minimize the issue.
```bash
tar -czf webapps.tar.gz --exclude='wp-content/cache' --exclude='node_modules' -C /home/runcloud webapps || true
```

## 2. MariaDB Dump Deprecation
On modern MariaDB deployments (like recent RunCloud stacks), running `mysqldump` prints a deprecation warning:
`mysqldump: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-dump' instead`
Use `mariadb-dump` directly to avoid script failures or noisy output in logs/cron emails.

## 3. RunCloud Nginx Configs
When backing up Nginx configs for a RunCloud host, grab both `conf.d` and `ssl` from `/etc/nginx-rc/`. Note that `ssl` might not exist if no SSL certificates are configured natively via RunCloud, so allow for its absence:
```bash
tar -czf nginx.tar.gz -C /etc nginx-rc/conf.d nginx-rc/ssl || true
```