Deluge Console Issue

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:


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!

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.

Please not that you must access the Deluge console via the debian-deluged user. See:
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 , it looks for config and states in /home/ 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…

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

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.

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/.sh etc.

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

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
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# :

echo "Torrent Details: " "$torrentname" "$torrentpath" "$torrentid"  >> /mnt/dietpi_userdata/execute_script.log

Ah, sorry I forgot execution permissions bit :wink::
chmod +x /mnt/dietpi_userdata/

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_eyes:, I need some coffee I think :smiley:.

Ok I ran chmod +x /mnt/dietpi_userdata/ 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?

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

Thanks for the help :slight_smile:

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.