Jump to content

Pause sabnzbd download during mover


Recommended Posts

Is there any way to do this? I had radarr upgrade my library and now its downloading multiple terabytes of data and the problem i'm having is that the download speed is almost as fast, sometimes faster, than the mover.  So the mover is still running 12+ hours later. Is there a way to do this without completely stopping sabnzbd so the upacker  can still finish as well as other programs adding things to the que.

Link to comment
  • 2 years later...

this is the first topic that comes up with searching for "unraid pause sabnzbd during mover"
So I thought I would answer it even tho it's old.

CA mover tuning allows you to run scripts when move starts and ends.
You can run a script to sent http request to sabnzbd to pause when move starts and resume when it ends

You can write this script however you want to

i created my own nodejs docker container with the npm module 'sabnzbd' installed
i then run that docker container to execute my scripts


this is my docker run sh script
 

#!/bin/sh

docker run -it --rm \
  -v /mnt/user/appdata/seethruhead_sabnzbdscriptrunner/scripts:/usr/src/app/scripts \
  -e URL=http://SABNZBDHOST:8080 \
  -e APIKEY=YOURAPIKEY \
  --network="YOURDOCKERNETWORK" \
  seethruhead/sabnzbdscriptrunner node $1

CA mover schedule settings:

Script to run before mover (No checks, always runs): /mnt/user/appdata/seethruhead_sabnzbdscriptrunner/run.sh ./scripts/pause.js
Script to run after mover (No checks, always runs): /mnt/user/appdata/seethruhead_sabnzbdscriptrunner/run.sh ./scripts/resume.js

 

i places run.sh and my scripts folder into /mtn/user/appdata/seethruhead_sabnzbdscriptrunner
the scripts folder is mounted to my container

pause.js:

 

const SABnzbd = require('sabnzbd');

if (!(process.env.URL && process.env.APIKEY)) {
  console.error('Missing URL OR APIKEY');
  process.exit(1);
}

const client = new SABnzbd(process.env.URL, process.env.APIKEY);

client.version().then(version => {
  console.log(version);
  client.queue.pause().then(() => {
    console.log('client paused');
    process.exit(0);
  })
}).catch(error => {
  console.log('error');
  console.log(error.message);
});

resume.js
 

const SABnzbd = require('sabnzbd');

if (!(process.env.URL && process.env.APIKEY)) {
  console.error('Missing URL OR APIKEY');
  process.exit(1);
}

const client = new SABnzbd(process.env.URL, process.env.APIKEY);

client.version().then(version => {
  console.log(version);
  client.queue.resume().then(() => {
    console.log('client resumed');
    process.exit(0);
  })
}).catch(error => {
  console.log('error');
  console.log(error.message);
});

 

There are easier ways to do this but i wanted to use javascript for some reason.

hopefully this will answer the question for anyone googling for this search term

Edited by SeeThruHead
Link to comment
  • 5 weeks later...
  • 1 year later...
On 1/25/2022 at 6:31 AM, stayupthetree said:

Yooo. Thank you! Op maybhave moved on. But you dropping in an answer to and old question will help future people who search like did for answers. We typically find "no one ever helped" or "nevermind figured it out" without any actual solutions.

 

Thank Thank Thank you

I was actually just searching on a way to do this also. Can you give some of use more beginner docker users some clarification on how to do this?

I created the folders and script files in appdata
I created the docker run script in my user scripts

 

but don't know how to install and where to go and configure for node and the sabnzbd node module.

 

Any help is appreciated!

Link to comment
  • 1 year later...

Just wanted to chime in, with some very simple bash scripts. I'm using these, since I'm running SABnzbd behind a reverse proxy, but I'm sure they work fine using local addresses as well.

 

pauseSAB.sh (before mover starts)

#!/bin/bash

# SABnzbd API key
API_KEY="insert-api-key-here"

# SABnzbd URL
URL="https://sabnzbd.domain.com/api"

# Pause command to SABnzbd
curl -s "$URL?apikey=$API_KEY&mode=pause" > /dev/null

 

 

resumeSAB.sh (after mover ends)

#!/bin/bash

# SABnzbd API key
API_KEY="insert-api-key-here"

# SABnzbd URL
URL="https://sabnzbd.domain.com/api"

# Pause command to SABnzbd
curl -s "$URL?apikey=$API_KEY&mode=resume" > /dev/null

 

The scripts work fine and pauses SABnzbd instantly. I haven't tested them extensively with the Mover running yet, though. But they do as advertised - pauses and resumes SABnzbd's downloads :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...