Incorrect or missing information? Post-processing scripts

SABnzbd can run a user-provided script to be executed when a job has completed without errors.

Scripts can be Python scripts, bash scripts and BAT scripts. All scripts must be located in the scripts-directory, that can be specified in Config->Folders. Furthermore, the script must be executable. On Linux this means the x-bit must be on. On Windows, the requirement is that the script's extension is listed in your system's PATHEXT environment variable.

The scripts can be used in these contexts:

  • Associated with a job entry on the Main page
  • Changed for a job on the Queue page
  • Associated with a user-defined category
  • Associated with the empty-queue event on the Queue page

A post-processing script will only run when the job has completed without errors. If you want to run the script always, you need to disable the option "Post-Process Only Verified Jobs".

The console output of the script is captured by SABnzbd and is saved in the so called "Script Log" which can be opened from the history details. The output will be added to the (optional) notification email and can be examined in the History page.


The script will receive the parameters described below.

Please note: Use %1 in Windows scripts and $1 in Unix scripts. In Windows the parameters will be enclosed in double quotes ("my name").
On Posix systems (macOS, Linux, Unix) the parameters will not have quotes at all.

Position Description
1 The final directory of the job (full path)
2 The original name of the NZB file
3 Clean version of the job name (no path info and ".nzb" removed)
4 Indexer's report number (if supported)
5 User-defined category
6 Group that the NZB was posted in e.g. alt.binaries.x
7 Status of post processing.
  • 0 = OK
  • 1 = Failed verification
  • 2 = Failed unpack
  • 3 = 1+2
  • -1 = Failed post processing
8 URL to be called when job failed (if provided by the server, it is always sent, so check parameter 7!).
The URL is provided by some indexers as the X-DNZB-Failure header.

All parameters are properly quoted so that they may contain embedded spaces.

The "return" code that your script itself returns should be 0 if all went well or non-zero if errors occurred. If the return code is something else than 0, SABnzbd's History will show that return code (also known as exit code) in green surrounded by "Exit(...)".

A script can return an exit code. SABnzbd will show a non-zero code in the download report, but the job will not be flagged as failed.
Note: Release 1.0.0 has an option in Config->Switches to let a non-zero code mark the job as failed.

Example Python script

The get the parameters in python, you can do this:

import sys
    (scriptname,directory,orgnzbname,jobname,reportnumber,category,group,postprocstatus,url) = sys.argv
        # are we testing only?
        directory = sys.argv[1]
        print "No commandline parameters found"

# continue script

# Your code goes here

# Success code