Transmission All-in-One manage script

Hello Guys,

I would like to share with you script that I was working on time-by-time for past month or two. I was originally using numerous scripts I found over the web to do what I need, but non of them were able to manage Transmission queue on My Book due to the bug related to this system that prevent showing torrent status (Stopped/Download/Seed) correctly from transmission-remote list output.
So I start developing my own script to use debug mode of Transmission Remote and parse JSON within bash to properly identify torrent state and to apply manage logic. Finally I end-up with single script to do everything I would think of someone would need from Transmission.

Let’s call it Transmission All-in-One manage script. Version 1.0

Features:

  • Install/UnInstall startup and shutdown scripts (overwrites default Optware scripts)
  • Enable/Disable startup of Transmission on boot as check flag
  • Start/Stop/ReStart of Transmission
  • Stability fix by setting EVENT_NOEPOLL=1; EVENT_NOEVPORT=1; EVENT_NODEVPOLL=1
  • Updating Blocklist from download.m0k.org
  • Edit Transmission config file and if changed force Transmission to re-read config file
  • Watch Transmission and Restart if not responding
  • Status of torrents in Transmission Remote native output format
  • Torrents Queue manage:
    • start and stop torrents according to MAX_TO_DOWNLOAD and MAX_TO_SEED values
    • stop seeding once Max Ratio is reached
    • respects ratio-limit from Transmission config file
    • move torrent data to Complete folder once enough seeded and remove from Transmission list if succeeded
    • use minimum calls to Transmission Remote
    • watch check included
    • overcome torrent Status bug on WD MyBook system by parsing JSON instead of regular list output

Installation:

cd /opt/bin
wget -O transmission http://pavel.kuzub.com/scripts/transmission
chmod a+x transmission
transmission install

CRON Jobs:

#Transmission Queue Control every 5 minutes
*/5 * * * * /opt/bin/transmission queue

#Transmission Restart every 2 hours as stability workaround
0 */2 * * * /opt/bin/transmission restart

Usage:

# Start Transmission
transmission start

# Stop Transmission
transmission stop

# Call Boot procedure
transmission startup

# Enable starting Transmission on boot procedure
transmission startup on

# Disable starting Transmission on boot procedure
transmission startup off

# Show Transmission Remote List
transmission status

# Restart Transmission
transmission restart

# Open VI (or another editor) to edit settings.json
transmission edit

# Watch Transmission and kick if needed
transmission watch

# Queue manage (for CRON)
transmission queue

# Install startup and shutdown scripts
transmission install

# Uninstall startup and shutdown scripts
transmission uninstall

# Show commands
transmission usage

Community discussion:

WD MyBook World Edition

4 Responses to “Transmission All-in-One manage script”

  1. alex Says:

    Hi I’ve a problem with transmission-daemon.
    after few time the server not respond, and I must be killall transmission and restart it.
    Do you have any idea for resolve this inconvenient.
    Best regards
    alessandro

  2. Pavel Kuzub Says:

    Hello Alex,

    This is a known problem with stability of Transmission. Script above has been made to mitigate this inconvenience. I recomment to restart daemon every 2 hours by cron job as proactive measure. Otherwise it will stuck in 3 hours and after you will be forced to restart - it will re-check ayour active torrents that will take a lot of time - much more than what you are loosing - 5 minutes once every 2 hours.

    Pavel

  3. sorin Says:

    hello
    first i want to say that the script is magic!
    i use it on a linkstation pro duo
    nice work
    thanks
    there is a litle problem
    i do not know how to set username and password for web interface .
    when i set it from settings.json thru command transmission edit,it works untill i restart transmission or the nas
    on the buffalo nas central at the script that they post there they say something like this :
    Note: If you want some security (always a good idea) for your web interface you can replace the lines
    /sbin/start-stop-daemon –start –quiet –exec /usr/local/bin/transmission-daemon
    in the above script with
    /sbin/start-stop-daemon –start –quiet –exec /usr/local/bin/transmission-daemon — -t -u -v

    your script is different and i do not finde where to modify and i do not know what to modify
    PLEASE HELP
    THANKS IN ADVANCE

  4. sorin Says:

    sorry this is the right line:
    in the above script with
    /sbin/start-stop-daemon –start –quiet –exec /usr/local/bin/transmission-daemon — -t -u -v

Leave a Reply

Spam protection by WP Captcha-Free


школа современных танцев в голосеевском районе