[Testing Script] Failure

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
sirchambo
Posts: 3
Joined: 27 Nov 2019, 12:47

[Testing Script] Failure

Post by sirchambo » 27 Nov 2019, 12:58

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.

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [Testing Script] Failure

Post by l2g » 27 Nov 2019, 15:14

add the following at the end and try again:

Code: Select all

exit 93

sirchambo
Posts: 3
Joined: 27 Nov 2019, 12:47

Re: [Testing Script] Failure

Post by sirchambo » 28 Nov 2019, 12:14

Worked! Thanks.

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

l2g
Posts: 227
Joined: 27 Jun 2014, 22:13
Contact:

Re: [Testing Script] Failure

Post by l2g » 28 Nov 2019, 22:25

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!

sirchambo
Posts: 3
Joined: 27 Nov 2019, 12:47

Re: [Testing Script] Failure

Post by sirchambo » 29 Nov 2019, 02:00

Many thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest