Saturday, April 28, 2012

Auto stop torrents at 100%

#!/bin/bash

P=100

id=`transmission-remote -l | cut -c 1-11 | sed "s/\*//"  | cut -c 3- | sed "s/^ //" | grep "$P\%" | cut -f 1 -d " " `

if [ -z $id ]
then
  echo "no match : $id"
else
  sleep 60

  echo "stopping $id"
  transmission-remote -t $id -S
fi