Temporarily prevent scheduled jobs

I use a “before” script for all my jobs. In this script, I check for the existence of a marker file and I’ll return a non-zero exit code if the marker is present.

if /i not "%DUPLICATI__OPERATIONNAME%"=="BACKUP" exit /b 0

if exist C:\YOUR_MARKER_FILE (
    exit /b 5
) else (
    exit /b 0
)

If you need extra info do decide, you can use “DUPLICATI__backup_name”. It will be the job’s name.

This script should be run-before, but this bug is preventing it from working properly: Run-script-before with exit 1 saves metadata of aborted backup to statistics · Issue #4344 · duplicati/duplicati · GitHub
So I use it just with run-before-required instead. The only issue is that it will show errors/warnings in the web UI.

The possible exit codes for run-before are those:

0: OK, run operation
1: OK, don't run operation
2: Warning, run operation
3: Warning, don't run operation
4: Error, run operation
5: Error don't run operation

Any other non-zero code: don't run the operation

For run-before-required, any non-zero exit code will abort.
But, when that bug is fixed, you can have better codes with run-before.

2 Likes