unRAID Mover and Deluge
When you make use of the unRAID cache drive for your /data/torrents
share, and the torrents in Deluge are still seeding, the mover can't move files since they are still in use.
Using the following instructions will allow you to move the files with the use of the Deluge JSON-RPC.
Workflow Rules
- Pause torrents in a specified age range that reside on your cache drive.
- Run the unRAID mover.
- Resume the torrents after the mover has completed.
Warning
The screenshots below are only EXAMPLES to show you how it should look and where you need to place the data that you need to add. They are NOT always a 100% reflection of the actual data, and not always the actual values you need to add.
- Always follow the recommendations described in the guide.
- If you have any questions, or aren't sure, just click the chat badge to join the Discord Channel where you can ask your questions directly.
Needed
deluge-mover
script
Download the following standalone Python script.
Thanks to zakary (Developer on cross-seed)
Plugins
Install the following plugins:
- User Scripts
- You will need to manually install the following packages for the correct Slackware version from https://packages.slackware.com/
- python3
- python-setuptools
- python-pip
Instructions
-
In your Unraid Dashboard go to
APP
and type in the search box:python 3 for unraid
-
Click on the install button to install everything you needed.
According to the developer, it will install python3, pip, and setuptools onto your Unraid systems. without library issues, and it should be fully compatible with Unraid 6 and 7.
In your Unraid terminal, type the following to determine your Slackware version.
cat /etc/slackware-version
Then go to https://packages.slackware.com/
-
Select the correct 64-bit Slackware version from the release dropdown box.
Currently:
Slackware64 15.0
forunRAID 6.x
Slackware64 current
forunRAID 7.x
-
Type in the required package you're looking for in the search box.
- Download the required packages.
Put them in your Unraid flash drive located in the boot/extra
folder. It will be installed upon Unraid boots.
To remove the old/wrong packages (that NerdTools installed for an earlier Slackware version), overwrite them with the new versions on your Unraid flash drive in the boot/extra
folder. Place the correct versions there and then reboot.
Setup
After you install the needed Plugins
- it's time to configure everything.
requests
module
deluge-mover.py
needs the requests Python module, so we need to make sure it's installed when your unRAID server starts, or when the Array is started the first time.
You can choose one of the following 3 options (select a tab) to install requests
.
With this option, we're going to install the requests
module when the Array is started the first time.
In your unRAID Dashboard, go to your Settings
tab and select User Scripts
in the User Utilities
section at the bottom.
At the bottom of the User Scripts
page select the ADD NEW SCRIPT
button.
A popup will appear asking you to name the script. For this example, we're going to use Install requests (deluge-mover)
and then click on OK
.
Click on the cogwheel of the new script in the list, and select Edit Script
.
Copy/Paste the following in the new window that opens, then click SAVE CHANGES
.
#!/bin/bash
pip3 install requests
Select in the schedule list when the script should run, and choose At First Array Start Only
.
Click on Apply
.
Finally, you will need to choose RUN IN BACKGROUND
or restart your unRAID server to install the requests
module.
With this option, we're going to create a Python virtual environment on our disk. We will use this to run and store dependencies (requests
) for this specific environment.
By doing this, we will only need to configure this once and it will be persistent after reboots (this differs from the previous steps).
First, you need to choose a location to start a new Python environment.
Info
In the next steps, you will be asked to choose a location to store the script, try to be consistent.
Suggestions:
/mnt/user/appdata/deluge/scripts/.venv
/mnt/user/data/scripts/.venv
Run the following command in unRAID's terminal in the directory you chose:
python3 -m venv --clear /mnt/user/data/scripts/.venv
We now need to enter this new environment and install our dependency (requests
) in it, run:
source /mnt/user/data/scripts/.venv/bin/activate
pip3 install requests
deactivate # to leave the environment
Info
Replace /mnt/user/data/scripts/.venv
with the path you have chosen.
With this option, we're going to install the requests
module when the unRAID server is started.
On your USB stick/key go to /boot/config
and open the go
file with your text editor (VSCode/Notepad++).
Copy/paste the following command
pip3 install requests
Restart your unRAID Server or run the above command from the terminal.
Script
Now, using your favorite text editor (VSCode/Notepad++) edit the script you downloaded at the beginning of the guide (HERE).
You only need to change a few options at the top of the script.
### CONFIGURATION VARIABLES ###
# this webui will need to be the JSON-RPC endpoint
# this ends with '/json'
deluge_webui = "http://localhost:8112/json"
deluge_password = "deluged"
# this changes whether the actual cache drive is checked for
# applicable files to pause/move before pausing.
#
# if this is false, it will pause all torrents in the age-range
# instead of only torrents in that range that exist on the cache
check_fs = False
# if you are using the mover tuner and don't want to use it for
# this script, set this to true
#
# if you do not use mover tuner, leave this as false
use_mover_old = False
# this is the absolute host path to your cache drive's downloads
# you only need this to be changed/set if using 'check_fs = True'
cache_download_path = "/mnt/cache/torrents/completed"
# the age range of days to look for relevant torrents to move
# i dont recommend setting age_day_max to less than the schedule
# you run the script on...
#
# if you run every 7 days, this should be at least 7 to prevent
# files from being stuck on your cache forever
#
# 0 disables age_day_max
# set both age vars to 0 to move everything on your cache drive
age_day_min = 3
age_day_max = 0
deluge_webui
=> The URL you use to access Deluge locally. (the"
should remain)deluge_password
=> Your Deluge WebUIPassword
. (the"
should remain)check_fs
=> If set toTrue
, it will check for the file on the cache drive before pausing.-
use_mover_old
=> See below.- If you do not use
Mover Tuning
, you DO NOT have to make any changes. - If you use
Mover Tuning
but DON'T want to use it for the script, change this toTrue
- If you use
Mover Tuning
and DO want to use it for the script, you will not have to make any changes. However, for this option, inside theMover Tuner
you will need to setMove Now button follows plugin filters
toYes
andDisable Mover running on a schedule
toNo
.
- If you do not use
-
cache_download_path
=> The location (host path) for your cache folder (if check_fs is True) age_day_min
=> Set the minimum age (days) of the torrents that you wish to move.age_day_max
=> Set the maximum age (days) of the torrents that you wish to move.
Copy the script to your preferred location
Place the script you just edited somewhere easy to access/remember.
Suggestions:
/mnt/user/appdata/deluge/scripts/deluge-mover.py
/mnt/user/data/scripts/deluge-mover.py
Final steps
Set up the scheduler for when the mover should run.
In your unRAID Dashboard, go to your Settings
tab and select User Scripts
in the User Utilities
section at the bottom.
At the bottom of the User Scripts
page select the ADD NEW SCRIPT
button.
A popup will appear asking you to name the script. For this example, we're going to use deluge-mover
and then click on OK
.
Click on the cogwheel of the new script in the list.
Choose your method (select a tab) and copy/paste the script in the new window that opens, then click SAVE CHANGES
.
#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
python3 /mnt/user/data/scripts/deluge-mover.py
echo "deluge-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover completed @ `date +%H:%M:%S`."
#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
/mnt/user/data/scripts/.venv/bin/python3 /mnt/user/data/scripts/deluge-mover.py
echo "deluge-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover completed @ `date +%H:%M:%S`."
Info
Replace /mnt/user/data/scripts/
in the script with the path you have chosen for the Python script.
Click the schedule dropdown to choose when the script should run. We want to select Custom
.
After changing to Custom
you will get an extra text field on the right where you can set your schedule (cron).
For this example, we're going to tell the script to run every day at 4 AM.
0 4 * * *
You can generate your scheduling HERE
Questions or Suggestions?