-
Notifications
You must be signed in to change notification settings - Fork 12
Queue Manager
Don't be scared about the length of this page! :) The idea and its realization is really simple, only the documentation is long. :)
The core concept of the setup is completely based on moving data AND meta files all around the place:
- there's a
.downloadingdirectory withcategories(sub-directories) with whichrtorrentwill start downloading new torrents (these are the watch directories in .rtorrent-config.rc) - when a download is finished
rtorrentmoves theirdatafromincompletedirectory ANDmetafiles (from one of the sub-directories of.downloadingdirectory) into their final place (meaning one of the sub-directories of.completeddirectory formetafiles and one of the sub-directories of the main directory fordata). The.downloadingdirectories get empty all the time in this way. - the
.queuedirectory withcategories(sub-directories) containmetafiles that should be moved into one of the sub-directories of.downloadingdir to be able to start them byrtorrentwhen there's free slot in thedownloading queue - there are 3 predefined
categories/directoryforrotating(deleting data) torrents:-
rotating(meansspecialgroup) andunsafecategories -
.delqueuedirectory: it should contain onlysymlinksto deletable meta files
-
- there is 1 special
category/directorycalledloadfor only loading (in closed state) but not starting torrents:- priority of files can be set to
Off, so they will only occupy the required spcae, and download can be started later (e.g. with^s)
- priority of files can be set to
- there's also an unsafe_data custom variable defined in
rtorrentthat makes torrents deletable (value2means that the torrent is in delete-queue, meaning.delqueuedirectory)
There's only 1 small queueTorrent.sh queue manager script with rotating (deleting data) capability and category support, that realize all the above mentioned tasks.
It contains 2 functionality:
-
downloading queue managerthat will queue torrents if there's free slot and free disk space for them -
disk free space managerthat will delete data to make free space for the newcomers
It runs from cron in every 5 minutes.
Moves meta files from one of the sub-directories of .queue directory into one of the sub-directories of .downloading directory, so rtorrent can start to download them.
- its top priority is that it shouldn't break
rtorrentin any case - it checks how many meta files are in the
.downloadingdirectory:- what the number of
active downloadsis currently and moves the appropriate number ofmetafiles from one of the sub-directories of.queuedirectory
- what the number of
-
size of downloading queueandorder of processingare configurable - it runs disk free space manager every time, even when there's nothing to be queued! (except for when
rtorrentis stopped) - it can send email report about all the action that was made (all of them are configurable)
- it doesn't move meta file(s) if:
-
rtorrentstopped running -
metafile is bogus (not valid torrent file), e.g. it has missingnameorsizeproperty- it moves
metafile into.bogusdirectory and appends current time to the movedmetafilename in this case
- it moves
- there's not
enough disk spacefor the queueable torrents, even after trying to make more- it moves
metafile into.oversizeddirectory and appends current time to the movedmetafilename in this case
- it moves
- target
datadirectory/file (in one of the sub-directories ofincompletedirectory) ORmetafile (in one of the sub-directories of.downloadingdirectory) exists- it moves
metafile into.duplicateddirectory and appends current time to the movedmetafilename in this case
- it moves
-
Note:
- if a
metafile is placed directly into one of the sub-directories of.downloadingdirectory (watch directories) then downloading will start immediately without the interaction ofQueue Manager-
hash-checkabledata/metafiles should be used in this way:-
hash-checkable datashould be placed intoincompletedirectory and itsmetafile into one the sub-directories of.downloadingdirectory, hash-checking will start immediately
-
-
- the categories directory structure has to be created 4 times in this way:
- in:
/mnt/Torrents,.queue,.downloading,.completeddirectories
- in:
Deletes meta files from the predefined rotating, unsafe category directories and from .delqueue directory, so rtorrent can delete their data!
-
rtorrentis configured to only delete their data if their unsafe_data custom variable is set to1or2! - processing order of deleting
metafiles is the following:- from
.delqueuedirectory (containingsymlinks) in reverse order, oldest first - from the predefined
rotating,unsafecategory directories in reverse order, oldest first, handling them altogether at the same time!
- from
- enabling this part of the script is configurable, it's disabled by default for safety reason:
- it can be enabled by setting
AUTOROTATETORRENTS=true
- it can be enabled by setting
- it only should be run by the
downloading queue manager - amount of
reserved disk spaceis configurable - it waits for 15 seconds after successful deletion of all
metafiles for lettingrtorrentto finish deleting data - it can send email report about all the deleted torrents (configurable)
- doesn't delete
metafile(s) if:- this functionality is
disabled - there's
enough disk space - there's
nothing to be deletedfrom the definedrotating,unsafecategories and.delqueuedirectory
- this functionality is