Page 1 of 1
Reload config file
Posted: November 29th, 2018, 6:47 pm
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.
Re: Reload config file
Posted: November 30th, 2018, 12:41 am
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.
Re: Reload config file
Posted: November 30th, 2018, 3:09 am
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?
Re: Reload config file
Posted: December 2nd, 2018, 4:48 pm
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.
Re: Reload config file
Posted: December 2nd, 2018, 5:03 pm
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?
Re: Reload config file
Posted: December 3rd, 2018, 3:10 am
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).
Re: Reload config file
Posted: December 5th, 2018, 12:43 pm
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.
Re: Reload config file
Posted: December 5th, 2018, 2:12 pm
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"
}
]
}
}
Re: Reload config file
Posted: December 5th, 2018, 2:29 pm
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
Re: Reload config file
Posted: December 6th, 2018, 4:51 am
by safihre
Oooooh now I finally understand you are trying to do something hacky instead of the normal way
Re: Reload config file
Posted: December 13th, 2018, 8:21 pm
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§ion=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.