Reload config file

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
InterClaw
Newbie
Newbie
Posts: 5
Joined: April 10th, 2014, 4:55 pm

Reload config file

Post by InterClaw »

After I save changes directly in sabnzbd.ini it doesn't seem like SABnzbd is detecting the changes and applying them, so it's not the same as saving changes in the UI.

I understand that this is probably not intended behavior. But what would be the best approach to make SABnzbd reread/reload the config file? Can I make that happen in the command line.

I'm trying to change settings in a batch script and I'd like to be able to apply them also. Running the executable again straight up I believe is one way, but it's clunky and logs me out of the web UI.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Reload config file

Post by sander »

Alternative: change settings via the API. See https://sabnzbd.org/wiki/advanced/api#set_config

I'm assuming SABnzbd will detect that automatically.
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Reload config file

Post by safihre »

Some settings require you to restart, but usually only in Config > Specials. This we usually also put on the wiki-pages if that's the case.
All other settings should be applied instantly.

Which setting exactly is not working for you?
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
InterClaw
Newbie
Newbie
Posts: 5
Joined: April 10th, 2014, 4:55 pm

Re: Reload config file

Post by InterClaw »

Yeah, I read a bit about the API, but then I actually have to do some coding... :) Might read into that some more!

The setting I'm trying to change is the password for a server.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Reload config file

Post by sander »

InterClaw wrote: December 2nd, 2018, 4:48 pm Yeah, I read a bit about the API, but then I actually have to do some coding... :) Might read into that some more!
or a curl one-liner
InterClaw wrote: December 2nd, 2018, 4:48 pm The setting I'm trying to change is the password for a server.
the password of the newsserver? .... oh, wait ... one of those free newsservers that change their password daily?
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Reload config file

Post by safihre »

Those changes are instant, it should auto-disconnect from the server and reconnect. No API is going to help there.

But if you have an error before, like "Password incorrect" then the server is blocked for 10 min, and this will not be reset when changing the password.
To reset this you can click Force Disconnect in the Status and Interface settings window, I think this should clear the timers (but maybe not).
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
InterClaw
Newbie
Newbie
Posts: 5
Joined: April 10th, 2014, 4:55 pm

Re: Reload config file

Post by InterClaw »

or a curl one-liner
A what now? :) I going to have to look into that!
the password of the newsserver? .... oh, wait ... one of those free newsservers that change their password daily?
You got me, yeah. :)
Those changes are instant, it should auto-disconnect from the server and reconnect. No API is going to help there.

But if you have an error before, like "Password incorrect" then the server is blocked for 10 min, and this will not be reset when changing the password.
To reset this you can click Force Disconnect in the Status and Interface settings window, I think this should clear the timers (but maybe not).
I'm not getting an error for this server. The transfer just stands still until a valid password is detected. Not quite sure what's going on behind the scenes, but if I manually save a new password the "normal" way in the UI, it only takes a couple of seconds for the transfer to resume. No error messages going on...

I tried it again, changing the password directly in the config file, and waited for 10 minutes, but nothing happened. I then did the "force disconnect" approach, but that didn't kick it off either.

For now the only things I know work are rerunning the executable (and getting logged out), restarting SABnzbd (obviously), or clicking "save changes" for the server.

But I need to look into this curl thing... :) Since if the API call is the equivalent of clicking "save changes" I don't see why that wouldn't work.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Reload config file

Post by sander »

OK ... the curl stuff:

I have a newsserver newszilla.xs4all.nl, for which I want to change the password to xjxjxjxjxj. The command is:

Code: Select all

curl http://127.0.0.1:8080/sabnzbd/api -F apikey=ec2c65b435aae7ef1b8521fa144791e7 -F mode=set_config -F section=servers -F name=newszilla.xs4all.nl  -F password=xjxjxjxjxj
with output

Code: Select all

{u'servers': [{'username': u'myname123', 'priority': 0, 'enable': 1, 'displayname': u'newszilla.xs4all.nl', 'name': u'newszilla.xs4all.nl', 'ssl_ciphers': '', 'notes': '', 'connections': 4, 'ssl': 0, 'host': '', 'timeout': 60, 'ssl_verify': 2, 'send_group': 0, 'password': '**********', 'optional': 0, 'port': 119, 'retention': 0}]}
Or, JSON-output

Code: Select all

$ curl -s http://127.0.0.1:8080/sabnzbd/api -F apikey=ec2c65b435aae7ef1b8521fa144791e7 -F mode=set_config -F section=servers -F name=newszilla.xs4all.nl  -F password=xjxjxjxjxj -F output=json | python -m json.tool
{
    "config": {
        "servers": [
            {
                "connections": 4,
                "displayname": "newszilla.xs4all.nl",
                "enable": 1,
                "host": "",
                "name": "newszilla.xs4all.nl",
                "notes": "",
                "optional": 0,
                "password": "**********",
                "port": 119,
                "priority": 0,
                "retention": 0,
                "send_group": 0,
                "ssl": 0,
                "ssl_ciphers": "",
                "ssl_verify": 2,
                "timeout": 60,
                "username": "myname123"
            }
        ]
    }
}
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Reload config file

Post by sander »

Here a clear indication it works:

Code: Select all

$ curl http://127.0.0.1:8080/sabnzbd/api -F apikey=ec2c65b435aae7ef1b8521fa144791e7 -F mode=set_config -F section=servers -F name=news.appelboor.com  -F password=bla11 -F connections=11

{u'servers': [{'username': u'asdf', 'priority': 0, 'enable': 1, 'displayname': u'news.appelboor.com', 'name': u'news.appelboor.com', 'ssl_ciphers': u'', 'notes': u'', 'connections': 11, 'ssl': 1, 'host': u'news.appelboor.com', 'timeout': 60, 'ssl_verify': 0, 'send_group': 0, 'password': '*****', 'optional': 0, 'port': 563, 'retention': 0}]}
and logging on that server:

Code: Select all

2018-12-05 20:26:29,418 Incoming connection from ('145.134.80.137', 52768)
2018-12-05 20:26:29,477 Connection from ('145.134.80.137', 52768) has TLS version TLSv1.2
2018-12-05 20:26:29,641 Thread-4 client said: authinfo user asdf
2018-12-05 20:26:29,756 Thread-4 client said: authinfo pass bla11
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Reload config file

Post by safihre »

Oooooh now I finally understand you are trying to do something hacky instead of the normal way :P
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
InterClaw
Newbie
Newbie
Posts: 5
Joined: April 10th, 2014, 4:55 pm

Re: Reload config file

Post by InterClaw »

Haha! :)

I thank you for your help, but cURL seems to be a program I need to keep on the computer for it to work. I thought it might be an integrated command in Windows.

I could solve that by just placing it on OneDrive or something (which would have been ok with me actually).

But in the end I've now opted for a much simpler solution:

I realized that to use the API I don't have to code a program. I can just call it directly in the browser...! This is probably blindingly obvious for everyone but me. I feel like I'm the last person on earth to realize it... :)

So what I did was that I set up this URL as a search engine in Chrome, with the keyword "sab".

Code: Select all

my.dns.name:port/sabnzbd/api?apikey=myapikey&mode=set_config&section=servers&name=usenet.server.name&password=%s
So to use it I just open a new tab, type "sab", hit space, paste the password, hit enter, and done. Only inconvenience is I have a tab to close, but that's minor. Perfectly happy with this. :)
Post Reply