Last active
May 7, 2023 15:33
-
-
Save danielbene/2a890f76ead64a80cfad5b801949cb94 to your computer and use it in GitHub Desktop.
Revisions
-
danielbene revised this gist
May 7, 2023 . 1 changed file with 15 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,32 +26,25 @@ set SEP=--------------------------------------------------------------- : -------------------------------------------------- CALL :RUNNER "backup", "%RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% backup %SYNC_FOLDER%" CALL :RUNNER "cleanup", "%RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% forget %CLEANUP_RULE% --prune" echo %SEP% echo Exit. endlocal pause EXIT :RUNNER echo %SEP% %~2 --dry-run -v echo %SEP% SET /P PROMPT=Execute %~1 (Y/[N])? IF /I "%PROMPT%" NEQ "Y" GOTO END %~2 echo %~1 done :END EXIT /B 0 -
danielbene revised this gist
May 7, 2023 . No changes.There are no files selected for viewing
-
danielbene revised this gist
May 7, 2023 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,11 @@ setlocal : -------------------------------------------------- : Avoiding the built in B2 backend according to the docs, and I could not make pruning work with the S3 api (lifecycle delete rule did absolutely nothing). : It's a bit clunky, but wokrs for me. Check this for more info: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#backblaze-b2. : You have to create the bucket and initialize the repository before running the script. : -------------------------------------------------- set RESTIC="c:\Programs\restic\restic.exe" : restic parameter paths should use forward slash -
danielbene revised this gist
May 7, 2023 . No changes.There are no files selected for viewing
-
danielbene created this gist
May 7, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ @echo off setlocal : -------------------------------------------------- : the bucket has to be created and the repository initialized before running the script set RESTIC="c:\Programs\restic\restic.exe" : restic parameter paths should use forward slash set RCLONE="c:/Programs/restic/rclone.exe" : password file contains a single line with the repository password set PWD="c:/Programs/restic/pwd" set REMOTE_NAME="awesome-sync" set BUCKET="awesome-sync-folder" set SYNC_FOLDER="c:/path/to/sync" set CLEANUP_RULE=--keep-daily 5 --keep-monthly 6 --keep-yearly 5 set SEP=--------------------------------------------------------------- : -------------------------------------------------- echo %SEP% %RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% backup %SYNC_FOLDER% --dry-run -v echo %SEP% SET /P AREYOUSURE=Execute backup (Y/[N])? IF /I "%AREYOUSURE%" NEQ "Y" GOTO END %RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% backup %SYNC_FOLDER% echo Backup done. :END echo %SEP% %RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% forget %CLEANUP_RULE% --prune --dry-run -v echo %SEP% SET /P AREYOUSURE=Execute cleanup (Y/[N])? IF /I "%AREYOUSURE%" NEQ "Y" GOTO ENDD %RESTIC% -r rclone:%REMOTE_NAME%:%BUCKET% -o rclone.program=%RCLONE% --password-file %PWD% forget %CLEANUP_RULE% --prune echo Cleanup done. :ENDD echo %SEP% echo Exit. endlocal pause