[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: 228
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: 228
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!

Merlincool
Posts: 7
Joined: 04 Feb 2020, 07:17

Re: [Testing Script] Failure

Post by Merlincool » 13 Feb 2020, 12:50

I have created bash script for post processing and It transfers my files on gdrive after its completion. I am using rclone for the same.

I don't get pp successful on my log report, because I think I have done some mistake.

I know the exit code is - exit 93.

This is what I have done after my rclone commands

Code: Select all

After echo "post-processing script"

#I have copied proper values of 93,94,92 from scripts

rclone copy $FILE mygdrive:

if [ "$?" -eq "0" ]
then
        echo "exit 93";
else 
        echo "exit 94"
fi
What I am missing in this?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Testing Script] Failure

Post by hugbug » 17 Feb 2020, 15:50

It should be

Code: Select all

exit 93;
instead of

Code: Select all

  echo "exit 93";

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests