nixarr
nixarr copied to clipboard
WIP: SABnzbd module for usenet integration
This aims to resolve Issue #21 by adding SABnzbd as an optional component.
As of submission, this build works, but I am seeking advice on a better implementation. I'm having to wrestle with a bit of a "chicken and egg" problem.
SABnzbd is very tight on security with its default configuration, and to enable the typical options you'd want a user to have (i.e. allowing connections through the firewall on the service's port), it's necessary to change the defaults on its config file. SABnzbd needs to run once to generate its initial config file, but any changes made to the config aren't processed until the service is restarted. This causes SABnzbd to initially start up in a state without any of the user's options applied.
I am not particularly fluent in tweaking systemd service configs, but I've got the following set up:
- ExecStartPre: a script that applies the user's options to the SABnzbd config file if it exists, with a "tag" specifying that changes were made by Nixarr
- ExecStart: the SABnzbd daemon process
- ExecStartPost: a script that waits for the SABnzbd config file to exist, then restarts its parent systemd service if the Nixarr "tag" does not exist on the config file (so that the ExecStartPre script can be run again, now that the file exists)
Forcing the SABnzbd service to restart feels crude and a bit problematic. It also has the caveat that the restart takes around 2 minutes to complete. I am not sure how to fix this. @rasmus-kirk if you have any knowledge on this that you are able to provide, I would be extremely appreciative.