Pre-Queue Script - Temp Folder Based on size.

Come up with a useful post-processing script? Share it here!
Post Reply
pyro1509
Newbie
Newbie
Posts: 1
Joined: January 4th, 2015, 3:29 pm

Pre-Queue Script - Temp Folder Based on size.

Post by pyro1509 »

Hello,

I was hoping to reduce some disk thrashing with my downloads.

My system (ubuntu) has ~8GB of ram and uses nearly non of it. Of course the verify, repair, and extraction all take up a lot of IO cycles.

The majority of my downloads are <2GB but I do have the occasional 10GB+ download.

So I would like to make a pre-process script which if the DL was <=2GB it would use a temp folder that is a ramdisk (tmpfs of ~3GB). Anything greater than that would then IO to the normal hard disk. This would reduce any disk action to only the extraction (greatly speeding up all the other actions).

The input parameter #6 is the size in bytes so that makes the process easy to start. But I am confused on how to get SAB to put certain downloads into different temp folders.

My inkling is to take the name of the NZB (which would be the resulting tmp folder name) and create a symlink to the tmpfs. Then when it write to Downloads/incomplete/New_NZB/ -> /tmpfs/New_NZB/

Code: Select all

if [$6 -gt 2000000000] then
ln -s /tmpfs/$1 Downloads/incomplete/$1
fi 
I think I might run into issues with SAB incrementing New_NZB.1

Any suggestions on how to make this a bit more elegant?

derkens
Newbie
Newbie
Posts: 4
Joined: March 3rd, 2015, 1:59 pm

Re: Pre-Queue Script - Temp Folder Based on size.

Post by derkens »

You should probably make 2 categories with different paths,
use the pre-queue script to switch between them.

Code: Select all

if   "$6" -lt "2000000000" ; then
echo "1"    
echo
echo
echo "nameoftmppathcategory"
echo
echo
echo

fandangos
Newbie
Newbie
Posts: 5
Joined: February 27th, 2022, 10:43 pm

Re: Pre-Queue Script - Temp Folder Based on size.

Post by fandangos »

I'm necrobumping this because this is still relevant today.

I have 32GB of RAM available and I could spare 15GB for a ram disk to use with Sab.
I get the idea of linking but that's not ideal.

How possible would be to have a built in feature to select the temporary folder based on download file size?
Or how can this be done instead of linking?

I often download content that is smaller than 15GB but sometimes it goes beyond 60GB.
Could this be done using sab's API from a command line?

User avatar
safihre
Administrator
Administrator
Posts: 4866
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Pre-Queue Script - Temp Folder Based on size.

Post by safihre »

Currently there's no way to set job specific temporary folders. When the queue script is called, the directory is already created so I don't know if the suggestion in the first post using "ln" would even work.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate

User avatar
sander
Release Testers
Release Testers
Posts: 8140
Joined: January 22nd, 2008, 2:22 pm

Re: Pre-Queue Script - Temp Folder Based on size.

Post by sander »

Google LVM with Ramdisk and normal disk

Post Reply