Refresh sabnzbd.ini config without using web interface

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
hal
Newbie
Newbie
Posts: 33
Joined: June 16th, 2008, 5:51 am

Refresh sabnzbd.ini config without using web interface

Post 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
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Refresh sabnzbd.ini config without using web interface

Post 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
hal
Newbie
Newbie
Posts: 33
Joined: June 16th, 2008, 5:51 am

Re: Refresh sabnzbd.ini config without using web interface

Post by hal »

Thanks for your reply, shypike
Do you know if any of the sabnzbd switches for windows are documented?
Thanks
Hal
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Refresh sabnzbd.ini config without using web interface

Post 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.
hal
Newbie
Newbie
Posts: 33
Joined: June 16th, 2008, 5:51 am

Re: Refresh sabnzbd.ini config without using web interface

Post 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
hal
Newbie
Newbie
Posts: 33
Joined: June 16th, 2008, 5:51 am

Re: Refresh sabnzbd.ini config without using web interface

Post 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
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Refresh sabnzbd.ini config without using web interface

Post 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 :)
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Refresh sabnzbd.ini config without using web interface

Post 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)
hal
Newbie
Newbie
Posts: 33
Joined: June 16th, 2008, 5:51 am

Re: Refresh sabnzbd.ini config without using web interface

Post 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
Post Reply