Deluge Console Issue

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Deluge Console Issue

Post by bookedirl »

Hello,
I have a Pi3 B+ that has a fresh install of dietpi. I'm rebuilding my torrent box that uses filebot (auto rename tool) that was previously on a Pi 2 but couldn't be updated to the current dietpi version due to it be so old.

My issue is with deluge console. I have a script that runs after the file is downloaded which pauses the torrent and passes the torrent data to the filebot script to run. For some reason it's not working at all. The only thing I can figure is the change to the user debian-deluged. The script won't pause the torrent due to that issue and it appears it isn't able to pull the torrent data $1, $2 and $3 which would have the path data filebot needs.

Here's the script I'm running:

Code: Select all

#!/bin/bash
TORRENT_ID=$1
TORRENT_NAME=$2
TORRENT_PATH=$3

deluge-console pause $TORRENT_ID
filebot -script fn:amc --output "/mnt/samba" --log-file /root/scripts/amc.log --action move --conflict override -non-strict --def music=y clean=y "movieFormat=Movies/{any{collection}{n+' ('+y+')'}}/{n} {'('+y+')'}{' CD'+pi}"  "ut_dir=$TORRENT_PATH/$TORRENT_NAME" "ut_kind=multi" "ut_title=$TORRENT_NAME" 
deluge-console del $TORRENT_ID
filebot -script fn:cleaner $TORRENT_PATH --log-file /root/scripts/cleaner.log
Any help would be appreciated!
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Re: Deluge Console Issue

Post by bookedirl »

I've tried just running something basic and echoing data to a test file and it appears its not even calling the script at all. Also, The deluged plugin for email notification won't work either. I have all the same info as my previous set up so I'm not sure why it's not working.

I think there's something similar happening with transmission as well. I tried to call a script from transmission once the download completes and it doesn't seem to call it.

It sounds like a permission issue but I can't figure out where. My previous installation had all the config data stored in the default locations the issue seemed to happen after I updated to the latest build of dietpi and the config files were moved to dietpi-userdata folder and managed by deluged-debian.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Deluge Console Issue

Post by MichaIng »

@bookedirl
Please not that you must access the Deluge console via the debian-deluged user. See: viewtopic.php?p=61#p61
sudo -u debian-deluged deluge-console

In case of Transmission you can access with other users to the CLI commands as well, as long as they have sufficient permissions to access debian-transmission owned files.
The reason is that Transmission always uses /etc/transmission-daemon/settings.json as config file, while Deluge searches/uses the ones inside the users home dir that is calling the commands. As the Deluge daemon and web UI runs as user debian-deluged, configuration files and states are all stored in its home dir /mnt/dietpi_userdata/deluge. If you now access as <user>, it looks for config and states in /home/<user> which do not exist or are created freshly then, so no access to current active torrents, downloads etc.

This per-user configuration is indeed an annoying thing in every case where actually a daemon/service is running that commonly (as recommended) runs as its own system user. One can never access with any other user then the one that runs the daemon/service...
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Re: Deluge Console Issue

Post by bookedirl »

Ok I'll try the sudo -u debian-deluged deluge-console.

I can't get deluge to run *ANY* script. I tried using the one from the deluge website

Code: Select all

#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
echo "Torrent Details: " "$torrentname" "$torrentpath" "$torrentid"  >> /tmp/execute_script.log
and it doesn't even do this. I can't figure out why it won't execute the script. It has been added to the execute plug-in. What would cause it not to even call the script?

Thank you.
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Deluge Console Issue

Post by MichaIng »

@bookedirl
It needs permissions to run the scripts. At best chown it to the debian-deluged user:
chown debian-deluged:debian-deluged /path/to/script

It also makes sense to store these scripts in the Deluge dir, e.g. save them to /mnt/dietpi_userdata/deluge/<script1>.sh etc.
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Re: Deluge Console Issue

Post by bookedirl »

I used chown and set the file to debian-deluged user but it still did not call it. Could it be something else?

Code: Select all

4 drwxrwxr-x 3 debian-deluged debian-deluged 4096 Jun 30 18:27 deluge
4 -rw-r--r-- 1 debian-deluged debian-deluged  156 Jun 30 19:11 done.sh
4 drwxrwxr-x 3 dietpi         dietpi         4096 Jun 30 19:11 downloads
4 drwxrwxr-x 2 dietpi         dietpi         4096 Jun 30 18:26 Music
4 drwxrwxr-x 2 dietpi         dietpi         4096 Jun 30 18:26 Pictures
4 drwxrwxr-x 2 dietpi         dietpi         4096 Jun 30 18:26 Video
root@DietPi:/mnt/dietpi_userdata# 
done.sh :

Code: Select all

#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
echo "Torrent Details: " "$torrentname" "$torrentpath" "$torrentid"  >> /mnt/dietpi_userdata/execute_script.log
Image
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Deluge Console Issue

Post by MichaIng »

@bookedirl
Ah, sorry I forgot execution permissions bit ;):
chmod +x /mnt/dietpi_userdata/done.sh

Actually with the above, the file owner does not matter anymore, as long as Deluge just needs to execute the script but not read it or write to it :roll:, I need some coffee I think :D.
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Re: Deluge Console Issue

Post by bookedirl »

Ok I ran chmod +x /mnt/dietpi_userdata/done.sh but it appears it still doesn't call the script. Is there a way to see if may be deluge is throwing an error when it tries to run the script?
bookedirl
Posts: 25
Joined: Sat Oct 24, 2015 7:15 am

Re: Deluge Console Issue

Post by bookedirl »

ok, so.. not sure why it worked but I rebooted for good measure and it worked.

Thanks for the help :)
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Deluge Console Issue

Post by MichaIng »

@bookedirl
Okay not sure why a reboot was required, but glad it finally worked. The chmod +x is definitely required, so far for future cases. Logs are btw in /var/log/deluge. This is RAMlog by default (if you didn't change in dietpi-software), so not boot persistent and cleared every hour.
Post Reply