全系统每日自动备份 · 双重保障(本地 + 邮箱)
| 备份任务 | 时间 | 内容 | 保留 |
|---|---|---|---|
| 全量备份 full_backup_v2.sh | 每天 2:30 | 12 个 PG 库 + 物业 H2 + APK/录音/前端 + 配置 | 数据库 14 天 / 文件 30 天 |
| 工作手机专项 wp_backup.sh | 每天 3:00 | 工作手机录音 + 关键数据 | 30 天 |
| 邮箱备份 mail_backup.sh | 每天 4:00 | 最新备份文件 → admin@guobiao.xin 收件箱 | 永久 |
| 健康监控 health_monitor.sh | 每 5 分钟 | 服务健康检查 + 自动恢复 | - |
本地磁盘: /opt/backups/ ├── db/ # 数据库备份 (guobiao_platform_日期.sql.gz 等) ├── h2/ # 物业 H2 数据库 ├── files/ # APK/录音/前端/chatim └── configs/ # nginx/systemd/.env 配置 邮箱: admin@guobiao.xin 收件箱 (每日备份邮件 + 密码清单) 密钥: /opt/keystores/ (keystore + 密码管理清单)
# 全量备份 bash /opt/scripts/full_backup_v2.sh # 邮箱备份 bash /opt/scripts/mail_backup.sh # 备份中心 Web 界面 (工作手机系统内) https://hr.guobiao.xin/work-phone/ → 备份中心
# 找到备份文件 ls /opt/backups/db/guobiao_platform_*.sql.gz | tail -1 # 恢复 (先建空库) gunzip -c /opt/backups/db/guobiao_platform_最新.sql.gz | \ psql -U guobiao -h localhost guobiao_platform
# 停止物业 → 替换 .mv.db 文件 → 重启 systemctl stop gansu-property cp /opt/backups/h2/gansu_property_最新.mv.db /opt/gansu-property/data/gansu_property.mv.db systemctl start gansu-property
tar xzf /opt/backups/configs/all_configs_最新.tar.gz -C / systemctl daemon-reload && systemctl restart nginx
1. 登录 https://mail.guobiao.xin/ (admin@guobiao.xin) 2. 打开每日备份邮件, 下载附件 3. 按上述流程恢复
# 完整性校验 (脚本自带) gzip -t /opt/backups/db/guobiao_platform_最新.sql.gz # 查看备份日志 tail -20 /var/log/guobiao_backup.log tail -10 /var/log/mail_backup.log