mirror of
https://github.com/myronblair/do-server-config
synced 2026-07-27 21:18:32 -05:00
[orbis] Weekly backup 2026-07-07 — 318 files changed, 48597 insertions(+), 7 deletions(-)
This commit is contained in:
@@ -116,6 +116,42 @@ log "Backing up MySQL credentials"
|
||||
# Document all databases
|
||||
mysql -e "SHOW DATABASES;" 2>/dev/null | grep -v "^Database\|information_schema\|performance_schema\|sys" > mysql/databases.txt || true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 9b. Actual database dumps — added 2026-07-07. Previously this only wrote a
|
||||
# list of database NAMES (mysql/databases.txt above), never the data
|
||||
# itself. If this server were lost, every site's real data — orders,
|
||||
# accounts, bookings — would be gone even though the backup "succeeded"
|
||||
# every week. Dumps every real business DB (skips cyberpanel's own
|
||||
# internal DB and MySQL system schemas).
|
||||
# ---------------------------------------------------------------------------
|
||||
log "Dumping site databases"
|
||||
mkdir -p databases
|
||||
for db in $(mysql -N -e "SHOW DATABASES;" 2>/dev/null | grep -vE "^(information_schema|performance_schema|mysql|sys|cyberpanel)$"); do
|
||||
if mysqldump --single-transaction --routines --triggers "$db" 2>/dev/null | gzip > "databases/${db}.sql.gz"; then
|
||||
SIZE=$(du -sh "databases/${db}.sql.gz" | cut -f1)
|
||||
log " $db -> ${db}.sql.gz ($SIZE)"
|
||||
else
|
||||
log " ERROR dumping $db"
|
||||
rm -f "databases/${db}.sql.gz"
|
||||
fi
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 9c. Actual website files — added 2026-07-07. Same gap as above: the config
|
||||
# backup only ever documented site names + disk usage (site-list.txt
|
||||
# below), never copied the files themselves. .git is excluded per site
|
||||
# since each site's own repo (on GitHub, mirrored to Gitea) already
|
||||
# covers code history — this is a content/uploads/config safety net for
|
||||
# whatever isn't (or hasn't yet been) committed there.
|
||||
# ---------------------------------------------------------------------------
|
||||
log "Backing up website files"
|
||||
mkdir -p sites
|
||||
for d in /home/*/public_html; do
|
||||
site=$(basename "$(dirname "$d")")
|
||||
mkdir -p "sites/$site"
|
||||
rsync -a --delete --exclude='.git' "$d/" "sites/$site/public_html/"
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 10. /opt/infra snapshot (already a separate git repo — copy contents)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user