Running as a Service (You dont need a service to control the service)

Questions and bug reports for Beta releases should be posted here.
Forum rules
Help us help you:
  • 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
spider31
Newbie
Newbie
Posts: 3
Joined: February 21st, 2011, 12:24 pm

Running as a Service (You dont need a service to control the service)

Post by spider31 »

Because a Windows Service cannot restart itself, we created the SABHelper service.
It is controlled in the same way as SABnzbd-service.exe, only it needs no additional parameters.
The service SABHelper will be created.
Note that this service (unlike SABnzbd) needs to be run as "Local System" or as another account with administrative privileges.

If your service exits with 1 or any non-negative number windows will restart it.

SABNzb is an awesome app.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Running as a Service (You dont need a service to control the service)

Post by shypike »

The Helper service also keep an eye on SABnzbd.
If it becomes unresponsive, it will restart it.

I think the auto restart by Windows needs to be set up explicitly in Services.
spider31
Newbie
Newbie
Posts: 3
Joined: February 21st, 2011, 12:24 pm

Re: Running as a Service (You dont need a service to control the service)

Post by spider31 »

All services will restart if they exit with a value of 1 or more.

Services can be setup to restart if they 'crash' this is a windows service feature.

You could spin a separate thread to monitor the main sab thread. (I have used this approach many times).

PS

I come from a pure windows programming background and I understand that SAB works on anything (well most things) so understand that putting effort into specific windows patterns is not always worth the effort. I just thought I would share the some ideas ;)
spider31
Newbie
Newbie
Posts: 3
Joined: February 21st, 2011, 12:24 pm

Re: Running as a Service (You dont need a service to control the service)

Post by spider31 »

Also Scheduled task are normally used a favour of windows services.  (They are exceptions to this rule)

In Windows 7 just have a look at how many they are.

I use Scheduled tasks to control SAB, Sick (2 copies, one for HD and one for SD) and CP.

You could have a scheduled task to start every so often to run you SAB checks...

But... support is weak pre-vista.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Running as a Service (You dont need a service to control the service)

Post by shypike »

Hey, we spent all this effort on it: it stays in :)
You can always choose to run it as a scheduled task, obviously ;)
Post Reply