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.)
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.
Any progress?
No luck at all, still a problem.
Having the same problem, script is being called but nothing happens, script runs fine in a non-docker environment like https://github.com/haugene/docker-transmission-openvpn/issues/494
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.
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.
@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
@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.
@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
@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)
@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
@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.
@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:
TRANSMISSION_SCRIPT_TORRENT_DONE_FILENAME value to /scripts/transmission-postprocess.sh#!/bin/bash chmod +x /scripts/transmission-postprocess.shHope this works out :)
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.
@Muckoma Exciting! Glad to help. MP4 conversion is a great idea actually, might implement that myself sometime.
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.
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.
can you help me with the script too i cannot get it to run at all keep getting permission denied.
i am not sure where to add the pre post script and post.
@d4g79 - Did you try going into the container and running the following command?
chmod +x /SCRIPTNAME.sh
Hi,
Yeah I did that but that was not the issue. The issue was noexec under the disk that had the script. Needs to remove this and now everything works as expected.
Thanks.
Sent from my iPhone
On 31 Jul 2020, at 12:19 am, Muckoma notifications@github.com wrote:

@d4g79 - Did you try going into the container and running the following command?
chmod +x /SCRIPTNAME.sh—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
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.
Unrar script i use below.
`#!/bin/bash
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"
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"
for rar in $(find . -name '*.rar' -exec dirname {} \; | sort -u);
do
pushd $rar
extract_rar
popd
done
fi`
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
Most helpful comment
I found that the oncomplete script was not carrying the execution bit into the container. I added a
chmod +x /on-complete.shto thetransmission-pre-start.shscript: https://github.com/gardner/tv/blob/20a5afcfeb13cdca56ca1aa04091a9c3d8f7d169/docker-compose.yml#L118 and now it runs.