feat: add BackupCard component and corresponding Backup model to enhance settings functionality and data management
This commit is contained in:
31
scripts/run-backup.ts
Normal file
31
scripts/run-backup.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env tsx
|
||||
/**
|
||||
* Script to run automatic backups
|
||||
* Can be executed via cron job or scheduled task
|
||||
* Usage: tsx scripts/run-backup.ts
|
||||
*/
|
||||
|
||||
import { backupService } from "../services/backup.service";
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
console.log("Checking if automatic backup should run...");
|
||||
const shouldRun = await backupService.shouldRunAutomaticBackup();
|
||||
|
||||
if (!shouldRun) {
|
||||
console.log("Backup not due yet. Skipping.");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log("Creating automatic backup...");
|
||||
const backup = await backupService.createBackup();
|
||||
console.log(`Backup created successfully: ${backup.filename} (${backup.size} bytes)`);
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error("Error running automatic backup:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user