Sonarr service architecture questions

Jackett is being refactored to install as a Windows service. I’d like to duplicate Sonarr’s behavior and have some questions:
Two features that the service cannot do: 1) create a tray icon, 2) do the netsh command for changing the web UI port.
Looks like the typical solution is to have the installer also register a normal startup program in the registry. And this host program does the stuff that requires admin permissions. Is this what Sonarr does? Also it looks like the nzbdrone service is able to start the host service?

Tray icon is because there is no user context, also why we have two executables.

We have no issues with OWIN on the service, but we also run permanent URL registrations directly through netsh.

Our installer installs the service, but nothing else to allow us to run. Sonarr can listen on localhost without issue on any port (as long as its not used already). Admin or system works for permanently registering Sonarr’s port though.

Oh I see whats going on. When Sonarr is started like a normal application its displays a tray icon. But starting the service directly will spawn the nzbdrone.host.exe but under system context and doesn’t show an icon ?

How is does the tray icon (user context) get started after reboot? Looks like the registry only contains an entry to start the service rather than the normal exe?

Sonarr knows how its being run, if its a service and you tell Sonarr to restart it will restart its service, if its NzbDrone.exe (tray), it will start a new instance and the current one will exit.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.