Transmission All-in-One manage script
Saturday, October 9th, 2010Hello 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