Page 1 of 1

[SOLVED] CLI check if speedlimit has been set?

Posted: December 21st, 2017, 4:24 pm
by OneCD
Hello.

The API docs show how to set the speedlimit and I've been using this for a long time to automatically restrict the download speeds when other things on my LAN require more bandwidth, but my current method is quite 'dumb'. It just keeps enforcing preset limits without knowing if it needs to - it can't check to see if SABnzbd is already speed-limited.

Is there a way (other than getting the full queue output via the API) to check if SABnzbd is currently using a speedlimit? Some file I can check? It seems this is not recorded in the .ini file for SABnzbd.

Thank you. :)

Re: CLI check if speedlimit has been set?

Posted: December 21st, 2017, 4:42 pm
by safihre
Hmmm, I think the API method is the only way!

Re: CLI check if speedlimit has been set?

Posted: December 21st, 2017, 5:23 pm
by OneCD
Okiedoke. Thanks @safihre. :)

Re: CLI check if speedlimit has been set?

Posted: December 22nd, 2017, 8:22 pm
by OneCD
Just a quick follow-up here. I checked out the API queue method and had this working in about 2 minutes:

Code: Select all

$ curl -s 'http://127.0.0.1:8800/sabnzbd/api?mode=queue&apikey=<my key>&output=json' | jq -r '.queue.speedlimit'
55.3
This is exactly what I'm after. :D

Re: [SOLVED] CLI check if speedlimit has been set?

Posted: December 23rd, 2017, 2:33 am
by safihre
Nice. Never heard of that command to parse json!

Re: [SOLVED] CLI check if speedlimit has been set?

Posted: December 23rd, 2017, 2:40 am
by OneCD
It's saved me a lot of time. :D

https://stedolan.github.io/jq/