Skip to content

Instantly share code, notes, and snippets.

@PizzaPete
Created July 30, 2014 07:51
Show Gist options
  • Save PizzaPete/cb1776a8170c38a24b47 to your computer and use it in GitHub Desktop.
Save PizzaPete/cb1776a8170c38a24b47 to your computer and use it in GitHub Desktop.
#!/bin/sh
TORRENTLIST=`transmission-remote --auth=user:password --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
for TORRENTID in $TORRENTLIST
do
echo "* * * * * Operations on torrent ID $TORRENTID starting. * * * * *"
DL_COMPLETED=`transmission-remote --auth=user:password --torrent $TORRENTID --info | grep "Percent Done: 100%"`
if [ "$DL_COMPLETED" != "" ]; then
echo "Torrent #$TORRENTID is completed."
echo "Removing torrent from list."
transmission-remote --auth=user:password --torrent $TORRENTID --remove
else
echo "Torrent #$TORRENTID is not completed. Ignoring."
fi
echo "* * * * * Operations on torrent ID $TORRENTID completed. * * * * *"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment