Can I intercept hybernate and/or detect SAB idle state

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
Rblaker2012
Newbie
Newbie
Posts: 4
Joined: June 23rd, 2012, 9:22 am

Can I intercept hybernate and/or detect SAB idle state

Post by Rblaker2012 »

Greetings,


I am looking for a way to programmaticly perform one or both of these functions for a sab install running on Windows 7.


1. Intercept the "On finish" command for hibernate so that I could run a bat file or my own exe when SAB tries to hibernate the system. I want to do some custom actions only when no downloads are active and no files are being acted upon.

Code: Select all

012-05-25 05:13:17,796::INFO::[postproc:619] Queue has finished, launching: <function system_hibernate at 0x017782F0> (None)
2. Programaticly detect that SAB has been idle for X min, at which time I could then do my custom actions.


I am not sure where I could start to monitor for these events/states. Does anyone have any ideas on what I could key off of.
I should mention, I know absolutely nothing about python. In my skills arsenal, this could be a DOS,VBS,VB6(trying to avoid), VB.net(still learning) or autoIT solution.

Thanks.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Help With Categories

Post by shypike »

You can set an end-of-queue script.
Use the arrow at te top right of the queue.
You can write the script in any language.
You will have to set a "scripts" folder in Config->Folders first and
put the script in that folder.
Rblaker2012
Newbie
Newbie
Posts: 4
Joined: June 23rd, 2012, 9:22 am

Re: Can I intercept hybernate and/or detect SAB idle state

Post by Rblaker2012 »

shypike, I looked at http://wiki.sabnzbd.org/user-scripts which states:
SABnzbd can run a user-provided script to be executed when a job has completed without errors.
but unless I'm mistaken this script would run after each and every item in the queue. The behavior I'm looking for is that my script would only run in the context of all jobs and processing are done.
This is why I was looking to see if I could hook in somehow to what drives the "hibernate" event because at least SAB is in a known state of idle.

So, Am I mistaken and the user scripts are an end of queue function or are they end of each job?

Thanks.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Help With Categories

Post by shypike »

The end-of-job script and end-of-queue script are two separate things.
Post Reply