#!/usr/bin/env bash # Filename: grab-magnets-from-watchdir.sh # Save this file into your /config directory tr=$(which transmission-remote) # set path for transmission-remote binary if [ -f /watch/*.magnet ] then for t in /watch/*.magnet; do echo "Adding "$t"" m=$(cat "$t") # get contents of magnet file $tr -n "$USER:$PASS" --add $m && \ /bin/mv "$t" "$t".added # add to transmission and rename the magnet file done fi