fix: backup — Remote-Verzeichnis per mkdir -p vor scp anlegen

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 16:05:38 +02:00
parent 4316670ce4
commit 49563e6bd0
+7
View File
@@ -98,6 +98,13 @@ async function runBackup(): Promise<void> {
'-o', 'ConnectTimeout=15', '-o', 'ConnectTimeout=15',
]; ];
// Zielverzeichnis auf Remote anlegen falls nicht vorhanden
await new Promise<void>((resolve, reject) => {
const ssh = spawn('ssh', [...sshOpts, sshHost, `mkdir -p ${remotePath}`]);
ssh.on('error', reject);
ssh.on('close', (code) => code === 0 ? resolve() : reject(new Error(`mkdir -p exit ${code}`)));
});
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
const scp = spawn('scp', [...sshOpts, localPath, `${sshHost}:${remotePath}/${filename}`]); const scp = spawn('scp', [...sshOpts, localPath, `${sshHost}:${remotePath}/${filename}`]);
let scpErr = ''; let scpErr = '';