This might seem a little convoluted, having one script on the docker container and one script called from the host machine's cron to trigger the docker script, but it works great for how I have my server setup with usernames & passwords living in environment variables outside the container. It runs at 4am local time everyday and redirects STOUT from the script to a clean.log file. My cleanup script just sits in the home dir and user's crontab references it: crontab -lĠ 4 * * * /home/User/cleanup>/home/User/clean.log Remember your container id will change ever time you restart it, that's why this line is so crucial. Of course, if you use a different docker image instead of haugene/transmission-openvpn, you'll need to change "haugene" to something maybe "transmission" or "linuxserver/transmission" if that's what you use so that grep & awk can correctly match your container id. I would definitely recommend leaving in the HAUGENE_ID line (change the variable name to whatever you like) just to make the next command easier to read. You can just as easily alter this by doing -e tmpUser="MyActualUsername" -e tmpPass="MyActualPassword" or omit the 2 environment flags entirely from this script and hardcode your user/pass into the original remove_finished_torrents script by changing the 2 instances of $tmpUser:$tmpPass to MyActualUsername:MyActualPassword. What I'm doing in this last script is taking the variables already setup - $RPC_U and $RPC_P - and passing them to temporary variables inside the transmission docker container - tmpUser and tmpPass. If you're wondering about tmpUser, tmpPass, and the RPC variables: I have my transmission rpc login/pass set through /etc/environment. If ] thenĮcho -n "Using server string from the environment: "Įcho -n "Using server string passed through parameters: "Įcho -n "Using hardcoded server string: "Įcho " $'`ĭocker exec -e tmpUser=$RPC_U -e tmpPass=$RPC_P $HAUGENE_ID /shared/remove_finished_torrentsĭon't forget to make it sudo chmod +x cleanup
#Transmission torrent windows download torrent#
# Which torrent states should be removed at 100% progress.ĭONE_STATES=( "Seeding " "Stopped " "Finished " "Idle ") # Server string: "host:port -auth username:password" Hardcoded string in this script (see below). # Server string is resolved in this order: # Clears finished downloads from Transmission.