Pauze sabnzbd from commandline?

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
beukie
Newbie
Newbie
Posts: 2
Joined: January 14th, 2011, 4:23 am

Pauze sabnzbd from commandline?

Post by beukie »

I was wondering if it was possible to pause sabnzbd from the commandline on linux?

The reason I ask is because I use a lot of rssfeeds for downloading and I like playing ps3, downloading and playing online games don't really match so i made a script that pings my ps3 to see if it runs and if so it stops sabnzbd (/etc/rc.d/sabnzbd stop), although that works  it would probably be nicer if I could pause downloading instead of stopping sabnzbd altogether, any suggestions?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Pauze sabnzbd from commandline?

Post by shypike »

Use an API call with wget or curl

Code: Select all

curl http://localhost:8080/api?mode=pause&apikey=APIKEY
You can find the APIKEY in Config->General

There's some documentation about the API here:
http://wiki.sabnzbd.org/api
beukie
Newbie
Newbie
Posts: 2
Joined: January 14th, 2011, 4:23 am

Re: Pauze sabnzbd from commandline?

Post by beukie »

Thanks shypike that worked great!
weybfr
Newbie
Newbie
Posts: 2
Joined: May 20th, 2014, 10:12 am

Re: Pauze sabnzbd from commandline?

Post by weybfr »

shypike wrote:Use an API call with wget or curl

Code: Select all

curl http://localhost:8080/api?mode=pause&apikey=APIKEY
You can find the APIKEY in Config->General

There's some documentation about the API here:
http://wiki.sabnzbd.org/api
hello,

I'm not as lucky as beukie, as i tried many commands & didn't succeed...
:(

I'm a newbie with linux, so I copied what shypike wrote, and I tried :

Code: Select all

>>wget http://localhost:8080/api?mode=pause&apikey=<APIKEY>
>> --17:13:16--  http://localhost:8080/api?mode=pause
           => `api?mode=pause'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24 [text/plain]
api?mode=pause: Permission denied

Cannot write to `api?mode=pause' (Permission denied).
I thought I forgot the /sabnzbd directory, so I tried :

Code: Select all

>> wget http://localhost:8080/sabnzbd/api?mode=pause&apikey=<APIKEY>
>> --17:13:45--  http://localhost:8080/sabnzbd/api?mode=pause
           => `api?mode=pause'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24 [text/plain]
api?mode=pause: Permission denied

Cannot write to `api?mode=pause' (Permission denied).
I tried to know what is the authentication mode :

Code: Select all

>> wget http://localhost:8080/sabnzbd/api?mode=auth
--17:14:15--  http://localhost:8080/sabnzbd/api?mode=auth
           => `api?mode=auth'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7 [text/plain]
api?mode=auth: Permission denied

Cannot write to `api?mode=auth' (Permission denied).
so i changed "wget" to "curl" :

Code: Select all

>> curl http://localhost:8080/sabnzbd/api?mode=auth
apikey
>> curl http://localhost:8080/sabnzbd/api?mode=pause&apikey=<APIKEY>
>> error: API Key Required

>>
so :
- it seems that the authentication mode is "apikey"
- but i can't do anything as if i didn't give the apikey !

and I can't desactivate the api key on the config/general page (it says "failure")

I don't understand what i'm doing wrong...
???

a huge thank you very much in advance for your help !

kind regards,
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Pauze sabnzbd from commandline?

Post by shypike »

Curl works a bit different:

Code: Select all

curl http://localhost:8080/sabnzbd/api -F apikey=APIKEY -F mode=pause
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Pauze sabnzbd from commandline?

Post by sander »

Isn't this about not using single quotes? Examples how to use it:

Code: Select all

sander@flappie:~$ wget 'http://localhost:8080/api?mode=pause' -o /dev/null -O-
ok
sander@flappie:~$

Code: Select all

sander@flappie:~$ lynx --dump 'http://localhost:8080/api?mode=pause'
ok

sander@flappie:~$

Code: Select all

sander@flappie:~$ curl 'http://localhost:8080/api?mode=pause'
ok
sander@flappie:~$
User avatar
jcfp
Release Testers
Release Testers
Posts: 1032
Joined: February 7th, 2008, 12:45 pm

Re: Pauze sabnzbd from commandline?

Post by jcfp »

Without proper quoting, the & would background the process and the remainder of the url (i.e., the api key) no longer send to sab. There would have been indications in the output pointing to all that though, I guess weybfr was posting only very selective parts.
weybfr
Newbie
Newbie
Posts: 2
Joined: May 20th, 2014, 10:12 am

Re: Pauze sabnzbd from commandline?

Post by weybfr »

sander wrote:Isn't this about not using single quotes? Examples how to use it:

...

Code: Select all

sander@flappie:~$ curl 'http://localhost:8080/api?mode=pause'
ok
sander@flappie:~$
hi everyone !

yes it worked with the quotes !
i didn't try the other proposed solutions as this one worked fine for me ! ;D

@jcfp : no i didn't post very selective parts of the output, i only hid my apikey...
so ? ???
i'll try to remember that the "&" would background the process ! ;)

thank you very much everybody for your quick help !

kind regrds
weybfr
Post Reply