Page 1 of 1

[Testing Script] Failure

Posted: 27 Nov 2019, 12:58
by sirchambo
I was testing the basic script from here: https://nzbget.net/post-processing-scripts

Code: Select all

#!/bin/sh 

#######################################
### NZBGET POST-PROCESSING SCRIPT   ###

# Print test message.
#
# This is a test script. It prints one message to log. Here in the
# long description we could write instructions for user.
#
# The long description can have multiple paragraphs when needed. Like
# this one.

### NZBGET POST-PROCESSING SCRIPT   ###
#######################################

echo "post-processing script test"
My results are odd in that the test script works, but is immediately followed by an error:
Image

Any thoughts would be appreciated.

Thanks.

Re: [Testing Script] Failure

Posted: 27 Nov 2019, 15:14
by l2g
add the following at the end and try again:

Code: Select all

exit 93

Re: [Testing Script] Failure

Posted: 28 Nov 2019, 12:14
by sirchambo
Worked! Thanks.

Is this exit call a pre-requisite for all extension scripts? If not, why was it necessary in this case?

Re: [Testing Script] Failure

Posted: 28 Nov 2019, 22:25
by l2g
NZBGet uses the exit code to determine the success of the plugin you wrote. It's a way of relaying back to the user:
  • Everything is good! I did what i was intended to do: exit 93
  • It was a failure; we just couldn't complete our task: exit 94
  • I didn't need to do anything, or I did do stuff, but it really isn't a good or bad outcome. exit 95
If you don't define an exit code, then by default zero (0) is returned (exit 0). This doesn't fit any of the expected 9X codes defined above, so NZBGet treats it as something bad happened.

It's more of just a note to keep in the back of your head when you write the scripts. Once you know this; you don't worry about it any more. You just return the code you intend on :). Good luck!

Re: [Testing Script] Failure

Posted: 29 Nov 2019, 02:00
by sirchambo
Many thanks!