Transfer will not execute shell script after torrent download completes
I want the bittorrent transfer client to execute a script that changes the owner and permissions of all torrents in the completed folder when the torrent finishes downloading.
I am using the following relevant settings in / etc / transmission -daemon / settings.json:
"download-dir": "/data/transmission/completed",
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/home/user/script.sh",
The script doesn't seem to be executed after the torrent has finished, I know there are other issues that can happen aside from the content of the script itself. The owner of the script file is debian-transmission and I have the permissions set to 777, so there should be no problem with the transmission accessing the script unless I missed something here.
The file / home / user / script.sh looks like this:
#!/bin/bash
echo sudopassword | /usr/bin/sudo -S /bin/chmod -f -R 777 /data/transmission/completed
echo sudopassword | /usr/bin/sudo -S /bin/chown -f -R user /data/transmission/completed
I know it's a bad form of using the sudo command this way, but I can execute the script myself and it will work correctly. I'm not sure why the transfer is not executing the script. Passing supports some environment variables like TR_TORRENT_NAME that I would like to use when the script is run. Is there anything I am not configuring in the file that will prevent the script from working properly and how I would use the environment variables?
Any help would be greatly appreciated!
source to share
No one has answered this question yet
Check out similar questions: