Post Processing and the $7 status parameter, bash

Come up with a useful post-processing script? Share it here!
Post Reply
Posts: 1
Joined: February 12th, 2017, 4:58 pm

Post Processing and the $7 status parameter, bash

Post by ElmStreetSleeps » February 12th, 2017, 5:05 pm

Ok I didn't realize I was confused by two separate script things. I was using the "Notification Script" API instead of the Post Processing API. The $1-$7 are a part of the Post Processing system for Sabnzbd, and the Notification Script thing doesn't seem to have as much detail. I see that the passed parameters are strings like "completed", "failed" etc. However it's not explained well enough on how to include the other parameters like filename, path etc.

SO ANYWAY, I GOT IT WORKING NOW. I have now correctly set each category in my client to use the script below, and I now get the notification.


I have been banging my head against the wall for the past few hours trying to get this to work. For some reason, Bash keeps receiving the $7 parameter as a non-zero character. All I'm trying to do is send myself a notification featuring the filename. I have every other piece working.

Here is my bash code:

Code: Select all

if [ "$7" = "0" ]; then
	echo "0 Status"
	curl -X POST -H "Content-Type:application/json" -H "Access-Token:MY_ACCESS_TOKEN" -d '{"type":"note","title":"'$3'['$5'] Success","body":"'$3'['$5'] Complete","Content-Type": "application/json"}'
	echo "Non zero status"
	curl -X POST -H "Content-Type:application/json" -H "Access-Token:MY_ACCESS_TOKEN" -d '{"type":"note","title":"'$3'['$5'] Failed","body":"'$3'['$5'] Failed","Content-Type": "application/json"}'
For some reason, I always get the `else` block, even on successful Sab transfers. I have tried every permutation possible in the if block. Double brackets, double equal signs, using the -eq operator, with and without quotes, and it never works right. Please help me! The $7 parameter is supposed to be 0 on success.

User avatar
Posts: 2603
Joined: April 30th, 2015, 7:35 am
Location: Switzerland

Re: Post Processing and the $7 status parameter, bash

Post by safihre » February 13th, 2017, 2:46 am

What could we do to improve the documentation? :)

Post Reply