# Blog Backup System - Next Steps

**Last Updated:** 2026-03-29

> **Superseded for strategy and day-to-day commands:** Use **[guides/BACKUP_GUIDE.md](guides/BACKUP_GUIDE.md)** as the canonical blog backup doc. This file is an older maintenance checklist. Retention, SEO sync pruning, and inventory scripts are documented there (2026-03-29).

Recommended next steps for completing the backup system setup and ongoing maintenance.

## Immediate Next Steps

### 1. Install Pre-Commit Hook (Recommended)

**Purpose:** Validate JSON files before commits to prevent invalid data

**Steps:**

```bash
# Copy hook to git hooks directory
cp scripts/blog/pre-commit-validate-json.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# Test hook
git add v2/data/blog/posts/lexikon/test.json  # Use a real file
git commit -m "test: Test pre-commit hook"
```

**Expected Result:**

- Hook validates JSON files
- Commits blocked if JSON invalid
- Valid commits proceed normally

### 2. Tag WordPress Master Backup (Recommended)

**Purpose:** Mark WordPress backup milestone in git history

**Steps:**

```bash
# Tag WordPress backup
./scripts/blog/tag-blog-migration.sh wordpress-backup

# Push tag to remote (if applicable)
git push origin blog-migration-wordpress-backup-2026-01-10
```

**Expected Result:**

- Git tag created
- Milestone documented
- Easy to reference in future

### 3. Set Up Automated Daily Backups (Optional)

**Purpose:** Automate regular backups for ongoing content protection

**Steps:**

**For Linux/macOS:**

```bash
# Edit crontab
crontab -e

# Add daily backup at 2 AM
0 2 * * * /path/to/landingpage/scripts/blog/automated-backup.sh >> /path/to/logs/backup.log 2>&1
```

**For Windows:**

1. Open Task Scheduler
2. Create Basic Task
3. Set trigger: Daily at 2 AM
4. Set action: Start program
   - Program: `python.exe`
   - Arguments: `scripts/blog/backup-blog-content.py --automated`
   - Start in: Project root directory

**Verify:**

```bash
# Check backup status after first run
python3 scripts/blog/check-backup-status.py --days 1
```

### 4. Test Full Restoration (Recommended)

**Purpose:** Verify restoration works end-to-end

**Steps:**

1. **Create Test Environment**

   ```bash
   # Create test directory
   mkdir -p /tmp/blog-restore-test
   cd /tmp/blog-restore-test
   ```

2. **Test WordPress Restoration**

   ```bash
   # Dry run first
   python3 /path/to/landingpage/scripts/blog/restore-from-wordpress-backup.py --dry-run

   # Actual restoration (if dry run successful)
   python3 /path/to/landingpage/scripts/blog/restore-from-wordpress-backup.py
   ```

3. **Verify Restoration**

   - Check post count matches (99 posts)
   - Verify JSON files valid
   - Test content loading

4. **Test Snapshot Restoration**

   ```bash
   # Get latest snapshot
   SNAPSHOT=$(ls -1 /path/to/landingpage/docs/backups/blog-snapshots/ | tail -1)

   # Dry run
   python3 /path/to/landingpage/scripts/blog/restore-from-snapshot.py \
     /path/to/landingpage/docs/backups/blog-snapshots/$SNAPSHOT --dry-run
   ```

## Ongoing Maintenance

### Weekly Tasks

1. **Check Backup Status**

   ```bash
   python3 scripts/blog/check-backup-status.py --days 7
   ```

2. **Review Backup Logs**

   ```bash
   tail -50 logs/backup-$(date +%Y%m%d).log
   ```

3. **Validate Recent Backups**
   ```bash
   # Get latest snapshot
   LATEST=$(ls -1 docs/backups/blog-snapshots/ | tail -1)
   python3 scripts/blog/validate-backup.py docs/backups/blog-snapshots/$LATEST
   ```

### Monthly Tasks

1. **Run Cleanup**

   ```bash
   # Preview cleanup
   python3 v2/scripts/blog/cleanup-old-backups.py --dry-run

   # Execute cleanup
   python3 v2/scripts/blog/cleanup-old-backups.py
   ```

2. **Test Restoration**

   - Test WordPress backup restoration (dry run)
   - Test snapshot restoration (dry run)
   - Verify backup accessibility

3. **Review Backup Index**
   - Update [guides/BACKUP_INDEX.md](guides/BACKUP_INDEX.md) if you maintain the optional index
   - Document any new backups
   - Note restoration history

### Quarterly Tasks

1. **Full System Test**

   - Create test backup
   - Test full restoration cycle
   - Verify all scripts working
   - Document test results

2. **Review Documentation**

   - Update backup procedures if needed
   - Document any issues encountered
   - Update best practices

3. **Archive Review**
   - Review archived backups
   - Verify archive integrity
   - Clean up if needed

## Before Migration

### Pre-Migration Checklist

- [ ] WordPress master backup created and validated
- [ ] Backup location documented
- [ ] Restoration procedures tested
- [ ] Backup scripts verified working
- [ ] Team trained on backup procedures

### During Migration

- [ ] Create snapshot before each major phase
- [ ] Validate backups after each phase
- [ ] Document backup locations
- [ ] Tag migration milestones

### Post-Migration

- [ ] Create final snapshot
- [ ] Verify WordPress backup still accessible
- [ ] Set up automated backups
- [ ] Test restoration procedures
- [ ] Document migration completion

## Troubleshooting

### If Backup Fails

1. **Check Error Logs**

   ```bash
   tail -100 logs/backup-$(date +%Y%m%d).log
   ```

2. **Verify Permissions**

   ```bash
   ls -la docs/backups/
   ls -la v2/data/blog/posts/
   ```

3. **Check Disk Space**

   ```bash
   df -h docs/backups/
   ```

4. **Re-run Backup**
   ```bash
   python3 scripts/blog/backup-blog-content.py --manual
   ```

### If Restoration Fails

1. **Validate Backup First**

   ```bash
   python3 scripts/blog/validate-backup.py <backup_directory>
   ```

2. **Check Target Permissions**

   ```bash
   ls -la v2/data/blog/posts/
   ```

3. **Try Dry Run**

   ```bash
   python3 scripts/blog/restore-from-snapshot.py <backup> --dry-run
   ```

4. **Check Restoration Report**
   ```bash
   cat docs/backups/restoration-report.json
   ```

## Success Metrics

### System Health

- ✅ WordPress master backup: Created and validated
- ✅ Snapshot backups: Working and tested
- ✅ Validation scripts: All passing
- ✅ Restoration scripts: Tested (dry run)
- ✅ Documentation: Complete

### Ongoing Health Checks

**Daily:**

- Automated backups running (if configured)
- No backup failures

**Weekly:**

- Backup status healthy
- Recent backups validated

**Monthly:**

- Cleanup executed
- Restoration tested
- Documentation updated

## Related Documentation

- [Backup Guide](content/blog/BACKUP_GUIDE.md) - Complete backup guide
- [Backup Process](BACKUP_PROCESS.md) - Backup procedures
- [Restoration Guide](content/blog/RESTORATION_GUIDE.md) - Restoration procedures
- [Backup System Summary](BACKUP_SYSTEM_SUMMARY.md) - Implementation summary
