docs for auto backup production db.

This commit is contained in:
2026-10-09 17:55:28 +03:30
parent 873b25e881
commit 1c3e7b6495
2 changed files with 26 additions and 3 deletions

View File

@@ -193,14 +193,35 @@ Register-ScheduledTask -TaskName 'Nudentic copy prod backup' -Action $action -Tr
If `Get-Date` shows UTC (`+00:00`), production’s jobs are 22:30, 07:30, and 12:30 UTC. Use **23:00**, **08:00**, and **13:00** in `$triggers` instead.
Try it once before relying on the schedule:
### Already on the staging PC
The task name is **Nudentic copy prod backup**. [`scripts/copy-prod-backup.ps1`](scripts/copy-prod-backup.ps1) only copies files. It does not create this task. Creating it is the `Register-ScheduledTask` block above, run once on the PC.
On the staging PC it is already registered as `Administrator`. The clock there is Iran time (`+03:30`), and the triggers are 02:30, 11:30, and 16:30. Running that block again replaces the same task.
See it:
```powershell
Get-ScheduledTask -TaskName 'Nudentic copy prod backup' | Format-List TaskName, State
Get-ScheduledTaskInfo -TaskName 'Nudentic copy prod backup' | Format-List LastRunTime, LastTaskResult, NextRunTime
```
`State: Ready` means it is scheduled. `LastTaskResult` **267011** and a `LastRunTime` in 1999 mean it has never run. **0** means the last copy finished.
Run it now without waiting for the next clock time:
```powershell
Start-ScheduledTask -TaskName 'Nudentic copy prod backup'
```
Then read `C:\dyolink\nudentic-backups\copy.log`. A good line says `Copied nudentic_….dump`. A second run says `Already present`. The first run also stores the production host key in `known_hosts` in that folder. A `.dump` larger than a few kilobytes in `C:\dyolink\nudentic-backups` is a good file.
You can also run the script by hand:
```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\dyolink\scripts\copy-prod-backup.ps1
```
A good run writes a `.dump` larger than a few kilobytes into `C:\dyolink\nudentic-backups` and a line in `C:\dyolink\nudentic-backups\copy.log`. The first run also stores the production host key in `known_hosts` in that folder. Run it again. The log should say each file is already there.
---
## 3. Load the dump into the local database