PostProcessing doesnt work?

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.
User avatar
switch
Moderator
Moderator
Posts: 1512
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: PostProcessing doesnt work?

Post by switch »

Yes that is right, the 'core' of the program resides in library.zip. The exe's are just front-ends to that file(sort of)

User avatar
shypike
Administrator
Administrator
Posts: 21043
Joined: January 18th, 2008, 12:49 pm

Re: PostProcessing doesnt work?

Post by shypike »

Someone else in the forum has an alternative way to start as service:

http://forums.sabnzbd.org/index.php?topic=284.0

If you cannot keep it running with anysrv, maybe this will work.

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

Thanks for the help. I'll try anything to get it to run as a service ;).
ANy idea what the signal 5 means?

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

I found it: http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

dwCtrlType

    The type of control signal received by the handler. This parameter can be one of the following values.
    Value Meaning

    CTRL_C_EVENT
    0
    A CTRL+C signal was received, either from keyboard input or from a signal generated by the GenerateConsoleCtrlEvent function.

    CTRL_BREAK_EVENT
    1
    A CTRL+BREAK signal was received, either from keyboard input or from a signal generated by GenerateConsoleCtrlEvent.

    CTRL_CLOSE_EVENT
    2
    A signal that the system sends to all processes attached to a console when the user closes the console (either by clicking Close on the console      window's window menu, or by clicking the End Task button command from Task Manager).

    CTRL_LOGOFF_EVENT
    5
    A signal that the system sends to all console processes when a user is logging off. This signal does not indicate which user is logging off, so no assumptions can be made.

    Note that this signal is received only by services. Interactive applications are terminated at logoff, so they are not present when the system sends this signal.


    CTRL_SHUTDOWN_EVENT
    6
  A signal that the system sends when the system is shutting down. Interactive applications are not present by the time the system sends this signal, therefore it can be received only be services in this situation. Services also have their own notification mechanism for shutdown events. For more information, see Handler.

    This signal can also be generated by an application using GenerateConsoleCtrlEvent.

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

looking at the code

Code: Select all

################################################################################
# Signal Handler                                                               #
################################################################################
def sig_handler(signum = None, frame = None):
    if type(signum) != type(None):
        logging.warning('[%s] Signal %s caught, saving and exiting...', __NAME__, signum)
    try:
        save_state()
    finally:
        os._exit(0)

Code: Select all

win32api.SetConsoleCtrlHandler(sabnzbd.sig_handler, True)
With ref http://aspn.activestate.com/ASPN/docs/A ... _meth.html it looks to me as if any signal caught will cause SABnzbd to quit?
An exception to "CTRL_LOGOFF_EVENT" 5 in case the -d switch is used should maybe be added?

(Im a complete py n00b so correct me if Im wrong ;) )
Last edited by Usenet on February 15th, 2008, 7:38 am, edited 1 time in total.

User avatar
shypike
Administrator
Administrator
Posts: 21043
Joined: January 18th, 2008, 12:49 pm

Re: PostProcessing doesnt work?

Post by shypike »

Thanks for the info. I simply never gave it a thought before.
Until we introduced a "windowed" version of SABnzbd, I never had a problem with run-as-service.
I still don't with SABnzbd-console.exe.

I'll pick up your suggestion about signal handling anyway, thanks.

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

Glad I can help :)
Just trying to figure out how to "compile" the source for win.. something with py2win.exe ... ;)

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

GREAT, now the service works!! Thanks for great work! :)

I have an addition to the "service" instructions on the wiki (and a few corrections but i skip em now..):

Create an 'AppParameters' value of type REG_SZ and specify the parameters for your app. For Example: AppParameters: REG_SZ: -d -f C:\bin\sabnzbd.ini

Doing this you can skip running startup scrips etc..

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

Great you updated the wiki.
PLease also change

Code: Select all

instsrv "c:\Program Files\Windows Resource Kits\Tools\srvany.exe"
to

Code: Select all

instsrv SABnzbd "c:\Program Files\Windows Resource Kits\Tools\srvany.exe"
to make it easier for first-timers ;)

User avatar
shypike
Administrator
Administrator
Posts: 21043
Joined: January 18th, 2008, 12:49 pm

Re: PostProcessing doesnt work?

Post by shypike »

Thanks, page has been updated.

Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: PostProcessing doesnt work?

Post by Usenet »

did a remake for my friends:

First download the Windows 2003 Resource kit from the Microsoft site and install it. Next, assuming that SABnzbd is installed in c:\bin\sabnzbd, do the following steps.

run in a cmd window:

Code: Select all

instsrv SABnzbd "c:\Program Files\Windows Resource Kits\Tools\srvany.exe"
run in a cmd window:

Code: Select all

install_service.reg
Content of install_service.reg, create a text file containing: (modify the path to match your setup.)

Code: Select all

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SABnzbd\Parameters]
"AppDirectory"="d:\\bin\\SABnzbd"
"Application"="D:\\bin\\SABnzbd\\SABnzbd.exe"
"AppParameters"="-d -f d:\\MyWorkDir\\sabnzbd.ini"
Set dependency, by running in a cmd.exe window:

Code: Select all

sc config SABnzbd depend= Tcpip
Now go to start -> run -> compmgmt.msc . Set a suitable user account for the service "SABnzbd" by creating a user account under "local users and groups". Under "Services and Programs" Choose "Services" and right click for properties for the "SABnzbd" service and specify the user account to run the service. Make sure the service has the "automatic" start up option

Start the service

Post Reply