Page 1 of 1

Notify on failed script status

Posted: August 14th, 2013, 8:51 am
by lazyelm
Good morning,

I have been using Sabnzbd for a while now and its fantastic. I am nearly at the point where i do not need to monitor anything. I am trying to do a little more cleanup and automation for the occasional time a file has downloaded successfully, been passed to sickbeard for post processessing and fails. Typically, it will fail if a folder does not exist for the main show. I would like to send a growl or email notification when it does.

I am not sure how to trigger a notification on a script fail as the failure is actually coming from the post processing script. Is this possible to do? I am open to any suggestions here.

I am using Windows environment :(

Thanks! O0

Re: Notify on failed script status

Posted: August 16th, 2013, 2:24 pm
by jcfp
lazyelm wrote:I am not sure how to trigger a notification on a script fail as the failure is actually coming from the post processing script. Is this possible to do? I am open to any suggestions here.
That could be done by running the current postproc script from another script, that simply passes along all arguments received from sab and monitors results (i.e., exit status) - similar to what people do when they want to run multiple scripts. That needs the sickbeard script to have a useful exit status indicating success or failure of the processing on the sickbeard end (no clue if it does), so the lower level script can decide what to do based on that. Otherwise, you'd end up having to analyse the human readable output, which is too cumbersome.

Re: Notify on failed script status

Posted: August 16th, 2013, 5:22 pm
by lazyelm
Thanks jcfp! I havent written any scripts for sab yet, is there any place that has examples i could take a look at to get started that would call one script an perform an action based on exit status from another script?

Re: Notify on failed script status

Posted: August 17th, 2013, 4:35 am
by jcfp
There's an entire subforum for post-processing scripts. Exit status of the last command run is typically available in some variable ("$?" in unix style shell scripts, where a value of zero means ok and anything else indicates failure). No doubt there's an equivalent even on windoze, but that os is not exactly my field of expertise. Question remains if the sickbeard script actually sets a useful exit status.