Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Torrent Done" Script Doesn't Appear to Run #802

Closed
MitchTalmadge opened this issue May 4, 2019 · 24 comments
Closed

"Torrent Done" Script Doesn't Appear to Run #802

MitchTalmadge opened this issue May 4, 2019 · 24 comments
Labels
inactivity Used by Stale bot to mark issues that will be closed

Comments

@MitchTalmadge
Copy link

Describe the problem

Using the "torrent done" environment variables (below), I cannot get a script to run when a torrent finishes downloading. The /data/transmission-home/transmission.log file does say that the script is called, but the script never does what it is supposed to, and the file atime does not change since its creation which implies that it is never read or executed.

Environment variables in question:
TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED
TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME

Related issues: (Nothing seemed to help. Many authors just abandoned their issues or did not describe their solution.)
#75
#483
#494
#622
#701

Add your docker run command

docker-compose.yml (Click Here)
version: "3"
services:
  transmission:
    image: haugene/transmission-openvpn:2.7
    ports:
      - "9091:9091"
    dns:
      - 1.1.1.1
      - 8.8.8.8
    cap_add:
      - NET_ADMIN
    devices:
      - "/dev/net/tun"
    volumes:
      - "/var/opt/transmission/data:/data"
      - "/opt/transmission/scripts:/scripts"
      - "/etc/localtime:/etc/localtime:ro"
    environment:
      - "PUID=120"
      - "PGID=124"
      - "OPENVPN_PROVIDER=PIA"
      - "OPENVPN_CONFIG=US Midwest,US West,US California,US Seattle"
      - "OPENVPN_USERNAME=?????????"
      - "OPENVPN_PASSWORD=?????????"
      - "WEBPROXY_ENABLED=false"
      - "LOCAL_NETWORK=127.0.0.1/32"
      - "TRANSMISSION_WEB_UI=transmission-web-control"
      - "TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=true"
      - "TRANSMISSION_RPC_USERNAME=????????????"
      - "TRANSMISSION_RPC_PASSWORD=????????????"
      - "TRANSMISSION_PEER_PORT=9092"
      - "TRANSMISSION_RATIO_LIMIT=2.0"
      - "TRANSMISSION_RATIO_LIMIT_ENABLED=true"
      - "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true"
      - "TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/scripts/test.sh"
    restart: unless-stopped

The PUID and PGID provided are for the user transmission, as seen here:

transmission:x:120:124::/home/transmission:/bin/false

Interestingly, when the docker container starts it claims that the user is called abc. Not sure why.

Script
The script that is being run is as follows:

test.sh:

echo "test" > test.txt

Permissions: (Full permissions granted to world as a last resort -- no luck)

mitchtalmadge@cloud:/opt/transmission/scripts$ ls -al
drwxr-xr-x 2 transmission transmission 4096 May  3 17:25 .
drwxr-xr-x 3 transmission transmission 4096 May  3 17:26 ..
-rwxrwxrwx 1 transmission transmission   23 May  3 17:25 test.sh
-rwxrwxrwx 1 transmission transmission    0 May  3 17:25 test.txt

The test.txt file is empty, even after download completes.

Logs

Docker Logs (Click Here)
mitchtalmadge@cloud:/opt/transmission$ sudo docker-compose logs
[sudo] password for mitchtalmadge:
Attaching to transmission_transmission_1
transmission_1  | Using OpenVPN provider: PIA
transmission_1  | 4 servers found in OPENVPN_CONFIG, US California chosen randomly
transmission_1  | Starting OpenVPN using config US California.ovpn
transmission_1  | Setting OPENVPN credentials...
transmission_1  | adding route to local network 127.0.0.1/32 via 172.27.0.1 dev eth0
transmission_1  | Fri May  3 17:27:44 2019 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 19 2019
transmission_1  | Fri May  3 17:27:44 2019 library versions: OpenSSL 1.0.2g  1 Mar 2016, LZO 2.08
transmission_1  | Fri May  3 17:27:44 2019 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
transmission_1  | Fri May  3 17:27:44 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]91.207.175.34:1198
transmission_1  | Fri May  3 17:27:44 2019 UDP link local: (not bound)
transmission_1  | Fri May  3 17:27:44 2019 UDP link remote: [AF_INET]91.207.175.34:1198
transmission_1  | Fri May  3 17:27:44 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
transmission_1  | Fri May  3 17:27:44 2019 [7d704bdf3731cc5d3e82f312868cc42a] Peer Connection Initiated with [AF_INET]91.207.175.34:1198
transmission_1  | Fri May  3 17:27:50 2019 TUN/TAP device tun0 opened
transmission_1  | Fri May  3 17:27:50 2019 /sbin/ip link set dev tun0 up mtu 1500
transmission_1  | Fri May  3 17:27:50 2019 /sbin/ip addr add dev tun0 local 10.8.11.6 peer 10.8.11.5
transmission_1  | Fri May  3 17:27:50 2019 /etc/openvpn/tunnelUp.sh tun0 1500 1558 10.8.11.6 10.8.11.5 init
transmission_1  | Up script executed with tun0 1500 1558 10.8.11.6 10.8.11.5 init
transmission_1  | Updating TRANSMISSION_BIND_ADDRESS_IPV4 to the ip of tun0 : 10.8.11.6
transmission_1  | Using Transmission Web Control  UI, overriding TRANSMISSION_WEB_HOME
transmission_1  | Generating transmission settings.json from env variables
transmission_1  | sed'ing True to true
transmission_1  | Enforcing ownership on transmission config directories
transmission_1  | Applying permissions to transmission config directories
transmission_1  | Setting owner for transmission paths to 120:124
transmission_1  | Setting permission for files (644) and directories (755)
transmission_1  |
transmission_1  | -------------------------------------
transmission_1  | Transmission will run as
transmission_1  | -------------------------------------
transmission_1  | User name:   abc
transmission_1  | User uid:    120
transmission_1  | User gid:    124
transmission_1  | -------------------------------------
transmission_1  |
transmission_1  | STARTING TRANSMISSION
transmission_1  | CONFIGURING PORT FORWARDING
transmission_1  | Transmission startup script complete.
transmission_1  | Wait for tunnel to be fully initialized and PIA is ready to give us a port
transmission_1  | Fri May  3 17:27:50 2019 Initialization Sequence Completed
transmission_1  | Generating new client id for PIA
transmission_1  | Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding
transmission_1  | curl encountered an error looking up new port: 7
Transmission Logs (Click Here)
[2019-05-03 17:31:08.125] Example_Torrent State changed from "Incomplete" to "Complete" (torrent.c:2218)
[2019-05-03 17:31:08.125] Example_Torrent moving "/data/incomplete/Example_Torrent/Example.txt" to "/data/completed/Example_Torrent/Example.txt" (torrent.c:3157)
[2019-05-03 17:31:08.125] Example_Torrent Calling script "/scripts/test.sh" (torrent.c:2118)

Host system:

Debian 9:

Linux 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64 GNU/Linux

Docker:

Docker version 18.09.5, build e8ff056dbc
docker-compose version 1.24.0, build 0aa59064

Thank you for your help.

@ptrsmk
Copy link

ptrsmk commented May 26, 2019

Any progress?

@MitchTalmadge
Copy link
Author

No luck at all, still a problem.

@Zunipox
Copy link

Zunipox commented May 26, 2019

Having the same problem, script is being called but nothing happens, script runs fine in a non-docker environment like #494

@gardner
Copy link

gardner commented Jun 14, 2019

I found that the oncomplete script was not carrying the execution bit into the container. I added a chmod +x /on-complete.sh to the transmission-pre-start.sh script: https://github.com/gardner/tv/blob/20a5afcfeb13cdca56ca1aa04091a9c3d8f7d169/docker-compose.yml#L118 and now it runs.

@MitchTalmadge
Copy link
Author

MitchTalmadge commented Jun 22, 2019

Adding chmod +x in my pre-start script like @gardner, plus also realizing that scripts are run in context of the root directory ( / ) is what solved my problem! So even if your script is at /scripts/foo.sh, it will be running in /. I think an improvement to this docker image could be made by automatically adding the exec flag to the scripts defined in the env vars.

@root-hal9000
Copy link

@gardner solution worked for me, and as for what @MitchTalmadge said, mine worked fine in the /scripts folder
PS.: I forked and adapted this script to remove torrents when completed, working for my version of this container running inside a Synology DS781+
https://gist.github.com/ffcruz85/6c9fb792fce4af0c4cb561fd653c86b6

@Muckoma
Copy link

Muckoma commented Oct 30, 2019

@MitchTalmadge @ffcruz85 - I tried this solution and wasn't able to get it to work. I am trying to run on a Synology NAS. Is there anyway to test it without having transmission do another download? The script runs fine via SSH.

@MitchTalmadge
Copy link
Author

MitchTalmadge commented Oct 30, 2019

@Muckoma

I would try a very simple test script. Try making a script with the following contents:

echo "test" > /test/test.txt

Then mount the /test directory somewhere in your host. Make the script executable with chmod +x in your pre-start script and then download a torrent test file (just so it's fast -- I don't know how to run the script without downloading).

Check if a test.txt file is created in the mount after the download. I hope this helps a little bit. Let me know if you end up doing this and how it goes

@Muckoma
Copy link

Muckoma commented Oct 30, 2019

@MitchTalmadge - Thanks for getting back so quickly.

So no luck there either.
I created a folder on my NAS called data. Inside data is a downloads folder which is where the docker contain points too.
Here is my steps..

Pre Process
#!/bin/bash chmod +x /data/transmission-home/transmission-postprocess.sh
Post Process Script:
#!/bin/sh -xu echo "test" > test.txt
(I also tried /data/test.txt as well but no luck)
Docker settings export:
{ "cap_add" : [ "NET_ADMIN" ], "cap_drop" : null, "cmd" : "dumb-init /etc/openvpn/start.sh", "cpu_priority" : 50, "devices" : [ { "CgroupPermissions" : "rwm", "PathInContainer" : "/dev/net/tun", "PathOnHost" : "/dev/net/tun" } ], "enable_publish_all_ports" : false, "enable_restart_policy" : false, "enabled" : true, "env_variables" : [ { "key" : "PATH", "value" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }, { "key" : "OPENVPN_USERNAME", "value" : "xxxxxx" }, { "key" : "OPENVPN_PASSWORD", "value" : "xxxxx" }, { "key" : "OPENVPN_PROVIDER", "value" : "NORDVPN" }, { "key" : "GLOBAL_APPLY_PERMISSIONS", "value" : "true" }, { "key" : "TRANSMISSION_ALT_SPEED_DOWN", "value" : "50" }, { "key" : "TRANSMISSION_ALT_SPEED_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_ALT_SPEED_TIME_BEGIN", "value" : "540" }, { "key" : "TRANSMISSION_ALT_SPEED_TIME_DAY", "value" : "127" }, { "key" : "TRANSMISSION_ALT_SPEED_TIME_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_ALT_SPEED_TIME_END", "value" : "1020" }, { "key" : "TRANSMISSION_ALT_SPEED_UP", "value" : "50" }, { "key" : "TRANSMISSION_BIND_ADDRESS_IPV4", "value" : "0.0.0.0" }, { "key" : "TRANSMISSION_BIND_ADDRESS_IPV6", "value" : "::" }, { "key" : "TRANSMISSION_BLOCKLIST_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_BLOCKLIST_URL", "value" : "http://www.example.com/blocklist" }, { "key" : "TRANSMISSION_CACHE_SIZE_MB", "value" : "4" }, { "key" : "TRANSMISSION_DHT_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_DOWNLOAD_DIR", "value" : "/data/completed" }, { "key" : "TRANSMISSION_DOWNLOAD_LIMIT", "value" : "100" }, { "key" : "TRANSMISSION_DOWNLOAD_LIMIT_ENABLED", "value" : "0" }, { "key" : "TRANSMISSION_DOWNLOAD_QUEUE_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_DOWNLOAD_QUEUE_SIZE", "value" : "5" }, { "key" : "TRANSMISSION_ENCRYPTION", "value" : "1" }, { "key" : "TRANSMISSION_IDLE_SEEDING_LIMIT", "value" : "30" }, { "key" : "TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_INCOMPLETE_DIR", "value" : "/data/incomplete" }, { "key" : "TRANSMISSION_INCOMPLETE_DIR_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_LPD_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_MAX_PEERS_GLOBAL", "value" : "200" }, { "key" : "TRANSMISSION_MESSAGE_LEVEL", "value" : "3" }, { "key" : "TRANSMISSION_PEER_CONGESTION_ALGORITHM", "value" : "" }, { "key" : "TRANSMISSION_PEER_ID_TTL_HOURS", "value" : "6" }, { "key" : "TRANSMISSION_PEER_LIMIT_GLOBAL", "value" : "200" }, { "key" : "TRANSMISSION_PEER_LIMIT_PER_TORRENT", "value" : "50" }, { "key" : "TRANSMISSION_PEER_PORT", "value" : "51413" }, { "key" : "TRANSMISSION_PEER_PORT_RANDOM_HIGH", "value" : "65535" }, { "key" : "TRANSMISSION_PEER_PORT_RANDOM_LOW", "value" : "49152" }, { "key" : "TRANSMISSION_PEER_PORT_RANDOM_ON_START", "value" : "false" }, { "key" : "TRANSMISSION_PEER_SOCKET_TOS", "value" : "default" }, { "key" : "TRANSMISSION_PEX_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_PORT_FORWARDING_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_PREALLOCATION", "value" : "1" }, { "key" : "TRANSMISSION_PREFETCH_ENABLED", "value" : "1" }, { "key" : "TRANSMISSION_QUEUE_STALLED_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_QUEUE_STALLED_MINUTES", "value" : "30" }, { "key" : "TRANSMISSION_RATIO_LIMIT", "value" : "2" }, { "key" : "TRANSMISSION_RATIO_LIMIT_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_RENAME_PARTIAL_FILES", "value" : "true" }, { "key" : "TRANSMISSION_RPC_AUTHENTICATION_REQUIRED", "value" : "false" }, { "key" : "TRANSMISSION_RPC_BIND_ADDRESS", "value" : "0.0.0.0" }, { "key" : "TRANSMISSION_RPC_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_RPC_HOST_WHITELIST", "value" : "" }, { "key" : "TRANSMISSION_RPC_HOST_WHITELIST_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_RPC_PASSWORD", "value" : "password" }, { "key" : "TRANSMISSION_RPC_PORT", "value" : "9091" }, { "key" : "TRANSMISSION_RPC_URL", "value" : "/transmission/" }, { "key" : "TRANSMISSION_RPC_USERNAME", "value" : "username" }, { "key" : "TRANSMISSION_RPC_WHITELIST", "value" : "127.0.0.1" }, { "key" : "TRANSMISSION_RPC_WHITELIST_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME", "value" : "/data/transmission-home/transmission-postprocess.sh" }, { "key" : "TRANSMISSION_SEED_QUEUE_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_SEED_QUEUE_SIZE", "value" : "10" }, { "key" : "TRANSMISSION_SPEED_LIMIT_DOWN", "value" : "100" }, { "key" : "TRANSMISSION_SPEED_LIMIT_DOWN_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_SPEED_LIMIT_UP", "value" : "100" }, { "key" : "TRANSMISSION_SPEED_LIMIT_UP_ENABLED", "value" : "false" }, { "key" : "TRANSMISSION_START_ADDED_TORRENTS", "value" : "true" }, { "key" : "TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES", "value" : "false" }, { "key" : "TRANSMISSION_UMASK", "value" : "0" }, { "key" : "TRANSMISSION_UPLOAD_LIMIT", "value" : "100" }, { "key" : "TRANSMISSION_UPLOAD_LIMIT_ENABLED", "value" : "0" }, { "key" : "TRANSMISSION_UPLOAD_SLOTS_PER_TORRENT", "value" : "14" }, { "key" : "TRANSMISSION_UTP_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_WATCH_DIR", "value" : "/data/watch" }, { "key" : "TRANSMISSION_WATCH_DIR_ENABLED", "value" : "true" }, { "key" : "TRANSMISSION_HOME", "value" : "/data/transmission-home" }, { "key" : "TRANSMISSION_WATCH_DIR_FORCE_GENERIC", "value" : "false" }, { "key" : "ENABLE_UFW", "value" : "false" }, { "key" : "UFW_ALLOW_GW_NET", "value" : "false" }, { "key" : "UFW_EXTRA_PORTS", "value" : "" }, { "key" : "UFW_DISABLE_IPTABLES_REJECT", "value" : "false" }, { "key" : "TRANSMISSION_WEB_UI", "value" : "" }, { "key" : "PUID", "value" : "1026" }, { "key" : "PGID", "value" : "100" }, { "key" : "TRANSMISSION_WEB_HOME", "value" : "" }, { "key" : "DROP_DEFAULT_ROUTE", "value" : "" }, { "key" : "WEBPROXY_ENABLED", "value" : "false" }, { "key" : "WEBPROXY_PORT", "value" : "8888" }, { "key" : "HEALTH_CHECK_HOST", "value" : "google.com" }, { "key" : "LOCAL_NETWORK", "value" : "192.168.xx.xx/250" }, { "key" : "OPENVPN_OPTS", "value" : "--inactive 3600 --ping 10 --ping-exit 60" }, { "key" : "NORDVPN_COUNTRY", "value" : "228" } ], "exporting" : false, "id" : "d63de9c72b72b0bd8c668c539108ab4c6e5d031aaea73d4d2706e99976cff269", "image" : "haugene/transmission-openvpn:latest", "is_ddsm" : false, "is_package" : false, "links" : [], "memory_limit" : 0, "name" : "Transmission", "network" : [ { "driver" : "bridge", "name" : "bridge" } ], "network_mode" : "default", "port_bindings" : [ { "container_port" : 9091, "host_port" : 9092, "type" : "tcp" } ], "privileged" : true, "shortcut" : { "enable_shortcut" : true, "enable_status_page" : false, "enable_web_page" : true, "web_page_url" : "https://192.168.xx.xx:9092" }, "use_host_network" : false, "volume_bindings" : [ { "host_volume_file" : "/docker/transmission/logs", "mount_point" : "/logs", "type" : "rw" }, { "host_volume_file" : "/data/downloads/transmission-home/transmission-postprocess.sh", "mount_point" : "/scripts/transmission-postprocess.sh", "type" : "rw" }, { "host_volume_file" : "/data/downloads/transmission-home/transmission-pre-start.sh", "mount_point" : "/scripts/transmission-pre-start.sh", "type" : "rw" }, { "host_volume_file" : "/data/downloads/", "mount_point" : "/data", "type" : "rw" }, { "host_absolute_path" : "/volume1/vpnInfo/resolv.conf", "mount_point" : "/etc/resolv.conf", "type" : "rw" } ] }

So all my transmission log says is
[2019-10-30 03:32:56.081] WildOnes.Vintii.Extended.CrossPlatform.Commercial.Font-SERiF Calling script "/data/transmission-home/transmission-postprocess.sh" (torrent.c:2118)

@MitchTalmadge
Copy link
Author

MitchTalmadge commented Oct 30, 2019

@Muckoma

I suspect that your script #!/bin/sh -xu echo "test" > test.txt is actually outputting a test.txt file into the root of the docker container where you wouldn't see it unless you open a shell within the container and take a look. That's the problem I was running into without knowing it. Although the script is located at /data/transmission-home/transmission-postprocess.sh, it actually runs relative to /, so test.txt becomes /test.txt. I'd either check if the file is in the container at the root, or explicitly define a directory in the script:

#!/bin/sh -xu echo "test" > /data/test.txt

@Muckoma
Copy link

Muckoma commented Oct 30, 2019

@MitchTalmadge - I tried /data/test.txt and same result. Nothing showed up.

I connected to the docker container and see both the scripts inside the /scripts directory inside the docker container.

@MitchTalmadge
Copy link
Author

@Muckoma

I just noticed that your transmission-postprocess.sh is actually located at /scripts/transmission-postprocess.sh within the container. I believe the pre-process script and the environment variable expect paths within the container.

Try making the following changes and then test the script again:

  • Change the TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME value to /scripts/transmission-postprocess.sh
  • Change the pre-process script to #!/bin/bash chmod +x /scripts/transmission-postprocess.sh

Hope this works out :)

@Muckoma
Copy link

Muckoma commented Oct 30, 2019

Finally got it working. Thank you so much for the help @MitchTalmadge. Now just gotta find the best way to get sickbeardMP4 converter to play nice. Basically I was trying to unrar files then let Sonarr handle it after that but also want Sickbeard MP4 converter to convert the file in the same go.

@MitchTalmadge
Copy link
Author

MitchTalmadge commented Oct 30, 2019

@Muckoma Exciting! Glad to help. MP4 conversion is a great idea actually, might implement that myself sometime.

@stale
Copy link

stale bot commented Apr 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactivity Used by Stale bot to mark issues that will be closed label Apr 5, 2020
@stale
Copy link

stale bot commented Apr 12, 2020

Note: The stale bot was recently added to this project to help weed out outdated issues. This will help us to focus time and energy on issues that are important and move the others out of the way. There could however be many issues that are still relevant but have gotten old without ever being fixed. As this is the first round of cleaning it might have been too eager. Feel free to re-open this issue if you think it deserves another look.

@stale stale bot closed this as completed Apr 12, 2020
@d4g79
Copy link

d4g79 commented Jul 30, 2020

can you help me with the script too i cannot get it to run at all keep getting permission denied.

@d4g79
Copy link

d4g79 commented Jul 30, 2020

i am not sure where to add the pre post script and post.

@Muckoma
Copy link

Muckoma commented Jul 30, 2020

@d4g79 - Did you try going into the container and running the following command?
chmod +x /SCRIPTNAME.sh

@d4g79
Copy link

d4g79 commented Jul 31, 2020 via email

@ptrsmk
Copy link

ptrsmk commented Dec 13, 2020

I can't get this to work. First off, this is what the log shows in attempting to get the pre script to chmod the "torrent done" script:

Executing /scripts/transmission-post-start.sh
/bin/bash: chmod +x /scripts/transmission-post-stop.sh: No such file or directory
/scripts/transmission-post-start.sh returned 127

I have tried having it chmod the script located in a few places, and I've done every version of the file path I could think of inside the post-start.sh script. I've also run it as a pre-start.sh script. No luck at all. I cannot understand how the response is "No such file or directory."

Needless to say, the "torrent done" script meant to echo to a test file is also not running when torrents complete.

@d4g79
Copy link

d4g79 commented Dec 13, 2020

Unrar script i use below.

`#!/bin/bash
#Unrar script for extracting files when torrent completes in transmisison.
#Once extracted, files are ready for sonarr/radarr processing.
#Make sure you change temp unrar directory to match your path.
function extract_rar() {
isRar=$(ls | grep *.rar)
if [ -n "$isRar" ]; then
# Mutli-part handeling.
isPart01="$(ls *.rar | egrep -i 'part01.rar|part1.rar')"
if [ -n "$isPart01" ]; then
isRar=$isPart01
fi
toUnrar="$(pwd)/$isRar"
#Move to new location so sonarr/radarr does not try to process, as unrar does not support name changing during extraction.
#Change the below to the temp unrar path.
pushd /torrents/unrar_staging
fileName="$(unrar e -y $toUnrar | egrep "^....*OK" | awk '{ print $2 }')"
# Move the file back for sonarr to locate and process.
mv $fileName $(dirname $toUnrar)
popd
fi
}

echo "Starting - $(date)"

cd "$TR_TORRENT_DIR"

if [ -d "$TR_TORRENT_NAME" ]; then
cd "$TR_TORRENT_NAME"
#Multiple-episode packs handling, those that contain a whole season, or just a single episode.
for rar in $(find . -name '*.rar' -exec dirname {} ; | sort -u);
do
pushd $rar
extract_rar
popd
done
fi`

@d4g79
Copy link

d4g79 commented Dec 13, 2020

I don't use the post start scripts, i use Portainer GUI and stacks to install the container. The ENV variable torrent-done is added in the docker script.


version: "2.4"
services:
transmission-openvpn:
image: haugene/transmission-openvpn
container_name: transmission-openvpn
restart: always
cap_add:
- NET_ADMIN
volumes:
- /srv/dev-disk-by-label-data/config/transmission:/data
- /srv/e14650c9-6848-431c-9e48-85e14e32cac2/torrents:/torrents
- /srv/e14650c9-6848-431c-9e48-85e14e32cac2/media:/media
environment:
- OPENVPN_PROVIDER=PIA
- OPENVPN_CONFIG=sweden
- OPENVPN_USERNAME=pxxxxxxx
- OPENVPN_PASSWORD=xxxxxxxx
- LOCAL_NETWORK=192.168.2.0/24
- DISABLE_PORT_UPDATER=yes
- OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
- PUID=1000
- PGID=100
- TZ=Australia/Sydney
- TRANSMISSION_BLOCKLIST_ENABLED=true
- TRANSMISSION_BLOCKLIST_URL=https://github.com/Naunter/BT_BlockLists/raw/master/bt_blocklists.gz
- TRANSMISSION_DHT_ENABLED=false
- TRANSMISSION_DOWNLOAD_DIR=/torrents/complete
- TRANSMISSION_INCOMPLETE_DIR=/torrents/incomplete
- TRANSMISSION_PEER_LIMIT_GLOBAL=1200
- TRANSMISSION_PEER_LIMIT_PER_TORRENT=240
- TRANSMISSION_PEX_ENABLED=false
- TRANSMISSION_SPEED_LIMIT_UP=15000
- TRANSMISSION_SPEED_LIMIT_UP_ENABLED=true
- TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true
- TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/data/unrar.sh
- TRANSMISSION_UMASK=0
- TRANSMISSION_WATCH_DIR=/torrents/watch
ports:
- 9091:9091
- 8888:8888
dns:
- 8.8.8.8
- 8.8.4.4


@eziminsk
Copy link

eziminsk commented Mar 3, 2023

Hi,
I had an Issue too for using "Torrent Done" , I was not sure that my script is working or not.
I tried to use ENV bellow, but it not worked:
TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=true

  • TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME=/
    I used the config file of transmission settings.json to put it.

And for my script .sh, I included some logs with the command bellow :
exec &> log2.log

It give the error message of my scripts, in my case I had issue with Sudo ans docker which was not installed

#!/usr/bin/env bash

HARDLINKS=true
LOGFILE="/watch/log.log"
LOGFILE2="/watch/log2.log"
exec &>$LOGFILE2
echo "docker" >> "$LOGFILE"
pwd >> "$LOGFILE"
whoami >> "$LOGFILE"
sudo docker version >> "$LOGFILE"
sudo docker exec next occ files:scan --all >> "$LOGFILE"
echo $? >> "$LOGFILE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactivity Used by Stale bot to mark issues that will be closed
Projects
None yet
Development

No branches or pull requests

8 participants