2

I'm trying to make a script in bash (first time) for the Deluge plugin execute so after a download is complete it will change the permissions of the downloaded torrent.

its:

#!bin/bash
torrentpath=$3
sudo chmod -R 777 $torrentpath

Also tried with $torrentpath in "", didnt work either. Copied the first 2 lines from the plugins wiki page (https://dev.deluge-torrent.org/wiki/Plugins/Execute).

Any idea how to make it work?

Totopesce
  • 21
  • 1

2 Answers2

1

Double quote your vars ... Do you really need sudo?

#!bin/bash
sudo chmod -R 777 "$3"
rr0ss0rr
  • 332
  • 2
  • 6
  • I think so, but I'm not sure, deluge creates files with 666 permissions, so the user doesnt have execute permission, thats why I thought it shuld be sudo, maybe not. Will try your script, thanks. – Totopesce Apr 01 '20 at 01:55
  • sudo is only needed if you don't have write access to the path – rr0ss0rr Apr 01 '20 at 02:18
  • removed sudo, but it says I dont have permission to run the script, the deluges user, the scripts user and the downloaded files user is the same. Tried just an echo "hello", but still the same problem – Totopesce Apr 01 '20 at 03:08
  • I'm not a deluge user ... How do you start deluge? and who owns the process? – rr0ss0rr Apr 01 '20 at 14:56
  • deluge is started in and by a docker, the user is user1 in deluges docker and is the owner of the script, everything that deluge downloads is owned by user1 too. – Totopesce Apr 01 '20 at 15:42
  • This is getting off topic from the initial question. Probably the easiest thing would be to find out which group user1 belongs to and add yourself to that group. – rr0ss0rr Apr 01 '20 at 15:51
  • I'm in that group, thats my user, its deluges user, its the owner of the files that deluge creates and its the owner of the script that I want the plugin to run. – Totopesce Apr 01 '20 at 16:10
1

Your shebang line is wrong, unless bin is in the cwd.

Change #!bin/bash to #!/bin/bash and that should fix it.

tgmatt
  • 11
  • 1