Scripts

These options allow you to integrate custom scripts with Duplicati operations, providing automation capabilities before and after backups, restores, or other tasks.

Pre and Post Operation Scripts Run custom scripts before an operation starts or after it completes. Use these to perform preparation tasks (like database locking), cleanup actions, or to trigger notifications based on operation results.

Control Flow Management Configure whether operations should continue or abort based on script execution status, with customizable timeout settings to prevent operation blocking.

Script Output Processing Post-operation scripts receive operation results via standard output, enabling conditional processing based on success or failure.

Scripting options

--run-script-before(Path) Run a script on startup. Executes a script before performing an operation. The operation will block until the script has completed or timed out.

--run-script-after(Path) Run a script on exit. Executes a script after performing an operation. The script will receive the operation results written to stdout.

--run-script-before-required(Path) Run a required script on startup. Executes a script before performing an operation. The operation will block until the script has completed or timed out. If the script returns a non-zero error code or times out, the operation will be aborted.

--run-script-timeout(Timespan) Sets the script timeout. Sets the maximum time a script is allowed to execute. If the script has not completed within this time, it will continue to execute but the operation will continue too, and no script output will be processed. Default value: 60s

Script Output Integration with Duplicati Logging

You can add custom entries directly to Duplicati's log system from your scripts by using special prefixes in stdout messages. This allows script events to appear in both the Duplicati Log and Reports alongside native application events.

Supported Log Level Prefixes:

  • LOG:INFO - For general information and success notifications

  • LOG:WARN - For potential issues that didn't prevent completion

  • LOG:ERROR - For critical failures that require attention

Example Usage (Linux / MacOS):

Example Usage (Windows):

These messages will be captured with their appropriate severity levels and integrated into Duplicati's logging system, making script events traceable within the same monitoring interfaces you use for Duplicati itself.

Sample Scripts

run-script-example.bat (Windows)

run-script-example.sh (Linux)

Last updated

Was this helpful?