fix: lokale Dump-Datei immer löschen (try/finally)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -77,6 +77,7 @@ async function runBackup(): Promise<void> {
|
||||
await dumpToFile(localPath);
|
||||
console.log(`[backup] Dump geschrieben: ${localPath}`);
|
||||
|
||||
try {
|
||||
if (!sshUrl) return;
|
||||
|
||||
const match = sshUrl.match(/^([^:]+):(.+)$/);
|
||||
@@ -115,7 +116,6 @@ async function runBackup(): Promise<void> {
|
||||
);
|
||||
});
|
||||
|
||||
unlinkSync(localPath);
|
||||
console.log(`[backup] ${filename} → ${sshHost}:${remotePath}`);
|
||||
|
||||
// Backups älter als 30 Tage auf Remote löschen
|
||||
@@ -130,4 +130,7 @@ async function runBackup(): Promise<void> {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
try { unlinkSync(localPath); } catch { /* bereits gelöscht oder nie angelegt */ }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user