Page 1 of 1

Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 5:57 am
by hal
Hi all
sabnzbd is a fantastic little app.  Thanks for your obvious hard work!

Can you tell me, if I manually amend a line in the sabnzbd.ini config file, is there a way to get the app to parse the whole file, or a particular setting, from the command line or by some means other than to manually restart the app or use the web interface to save the settings?

I am using the winxp platform.

Your advice would be appreciated
Thanks
Hal

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 6:35 am
by shypike
You need a full stop and start.
You can stop and start from a script.

Example of a Linux stop and start script.

Code: Select all

#! /bin/sh

case "$1" in
start)
echo "Starting SABnzbd."
/usr/bin/sudo -u sabuser -H /usr/local/bin/sabnzbd -d -f /home/sabuser/.sabnzbd/sabnzbd.ini
;;
stop)
echo "Shutting down SABnzbd."
/usr/bin/wget -q --delete-after "http://HOSTADDRESS:PORT/sabnzbd/api?mode=shutdown"
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 6:46 am
by hal
Thanks for your reply, shypike
Do you know if any of the sabnzbd switches for windows are documented?
Thanks
Hal

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 7:18 am
by switch
I replied to your request in irc, but if you didn't see it:

Download wget
make a script that does this:

Code: Select all

wget http://localhost:8080/sabnzbd/api?mode=config&name=speedlimit&value=100


I believe this should work under RC2, if not wait till RC3.

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 7:52 am
by hal
Switch thanks for your answer.
That sounds like a good idea.
Are the developers aware that there is a spelling error in the forum on the config/general page?...


s/bandwith/bandwidth

Although your method changes/saves the value, sabnzbd does not reparse the config, and so ignores the change.

Any other suggestions would be great
Thanks
Hal

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 8:17 am
by hal
This is my current script, in a win .bat file:

C:\Programs\wget-1.10.1-bin\bin\wget -q "http://localhost:8080/sabnzbd/api?mode= ... &value=100"

Although this changes the value in the config file, there are two problems with it:
1) The config file is not reparsed by sab
2) A file named "api@mode=config&name=speedlimit&value=100" is created on the local system which contains the response of "OK" from the server.  It would be better if this were not created.

Thanks
Hal

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 8:48 am
by shypike
1) It is set in the INI and used (or at least it will be in RC3)
2) One of the 1546 switches of wget will prevent the creation of a file :)

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 8:51 am
by switch
hal wrote: Switch thanks for your answer.
That sounds like a good idea.
Are the developers aware that there is a spelling error in the forum on the config/general page?...


s/bandwith/bandwidth

Although your method changes/saves the value, sabnzbd does not reparse the config, and so ignores the change.

Any other suggestions would be great
Thanks
Hal
Yes, the spelling error is from the original sab. If we change it people will lose their current value, we could have corrected it between 0.3 and 0.4 however I didn't want to leave an unneeded value in peoples config files that might lead to confusion if they try and change it.

If you can wait for RC3, which should be fairly soon, the api speedlimit change should function correctly.
As for wget creating the file, I think you may just have to add code into your script to just delete it, use -O in wget to specify the name of the downloaded file so you can easily remove it. (or as shypike has just said, find a switch that doesn't create the file)

Re: Refresh sabnzbd.ini config without using web interface

Posted: June 16th, 2008, 9:16 am
by hal
Nice one!
My windows bat files contain the following:

decrease_bandwidth.bat
C:\Programs\wget-1.10.1-bin\bin\wget -O deletethis.txt -q "http://localhost:8080/sabnzbd/api?mode= ... &value=100"
del deletethis.txt

increase_bandwidth.bat
C:\Programs\wget-1.10.1-bin\bin\wget -O deletethis.txt -q "http://localhost:8080/sabnzbd/api?mode= ... &value=200"
del deletethis.txt

Thanks for your help.  I look forward to the release of RC3!
Good luck with it, and best wishes to all!
Hal