-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_backup_file_size.js
More file actions
27 lines (22 loc) · 964 Bytes
/
verify_backup_file_size.js
File metadata and controls
27 lines (22 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env node
/**
* Verify Backup File Size
* Problem: Backup completes but file size is wrong (too small or too large)
* Solution: Send file size in payload, validate in DeadManPing panel
* Documentation: https://deadmanping.com/verify-backup-file-size
*/
const fs = require('fs');
const { execSync } = require('child_process');
const https = require('https');
const MONITOR_ID = 'YOUR_MONITOR_ID'; // Replace with your actual monitor ID
const backupFile = '/backups/db-backup.sql.gz';
// Run backup
execSync(`pg_dump mydb | gzip > ${backupFile}`);
// Get file size
const stats = fs.statSync(backupFile);
// Always ping with file size in payload
// In DeadManPing panel: set validation rules:
// - "size" >= 1048576 (1MB minimum)
// - "size" <= 10737418240 (10GB maximum)
// Panel will automatically detect if size is outside range
https.request(`https://deadmanping.com/api/ping/${MONITOR_ID}?size=${stats.size}`, { method: 'POST' }).end();