This is an old revision of the document!
Windows-Rechner mit Restic sichern
Restic-Windows-Binary herunterladen von … und nach c:\windows\restic.exe kopieren
Das Restic-Passwort sinnvollerweise als c:\users\<benutzername>\restic-password.txt abspeichern
Restic mit allen Parametern wird über eine Batch-Datei c:\windows\run_restic gestartet
- c:\windows\restic_backup.cmd
echo off cd %appdata% c:\windows\restic.exe backup --password-file c:\users\<benutzername>\restic-password.txt -r rest:https://<abc>:<xyz>@restic.hermes.markus-spring.info -v --use-fs-snapshot --host <hostname> --exclude-caches c:\users\<benutzername>\
Die Aufgabenplanung braucht Unterstützung von einer cmd/bat-Datei, um sicherzustellen, dass das Backup nur einmal täglich ausgeführt wird.
- c:\windows\run_restic_once_day.bat
@echo off setlocal EnableDelayedExpansion for /f "delims=" %%x in (c:\windows\restic_last_run.txt) do set lastRun=%%x set myRun= for /f "tokens=2 delims==" %%a in ('wmic os get localdatetime /value') do set "myRun=%%a" set "myRun=%myRun:~0,8%" set "myRun=%myRun:~6%%myRun:~4,2%%myRun:~0,4%" if defined lastRun if "%lastRun%"=="%myRun%" exit /b echo now running restic %myRun% %lastRun% c:\windows\restic_backup.cmd rem Kein Leerzeichen zwischen % und größer, sonst funktioniert der Vergleich nicht!!! echo %myRun%> c:\windows\restic_last_run.txt
