Page 1 of 1

Post Processing and the $7 status parameter, bash

Posted: February 12th, 2017, 5:05 pm
by ElmStreetSleeps
UPDATE
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.

ORIGINAL POST BELOW FOR REFERENCE

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

#!/bin/bash
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"}' https://api.pushbullet.com/v2/pushes
else 
	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"}' https://api.pushbullet.com/v2/pushes
fi
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.

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

Posted: February 13th, 2017, 2:46 am
by safihre
What could we do to improve the documentation? :)