Skip to content

Instantly share code, notes, and snippets.

@bulljit
bulljit / gist:1087570
Created July 17, 2011 13:05
Transmission-Daemon Script: OnComplete ClamAV
#!/bin/sh
#user or email the logs get mailed to in case of error / virus (if your mta supports non-local email)
ADMIN="user"
#Log file used, warning, if you re-use the log file all previous data will be overwritten each time the script is run.
LOGFILE="/var/log/transmission/scanlogs/transmission-completed-$TR_TORRENT_NAME.log"
#Boolean to choose if logs should be deleted when no error occured or virus was found
DELETE_LOG_FILES_ON_OK=false
#Boolean to choose if logs should be mailed when no error occured or virus was found
@bulljit
bulljit / transmissionUnRAR.sh
Created January 23, 2011 02:31
Transmission-Daemon Script: OnComplete unrar files and delete torrent
#!/bin/sh
DEST_DIR="/some/other/dir"
function linker() { # create simlink to downloaded files, rather than copy to final directory
if [ ! -d "$DEST_DIR/$1" ]; then mkdir "$DEST_DIR/$1"; fi
cd "$1"
for F in *; do
if [ -d "$F" ]; then linker "$1/$F"; fi
ln -s "$TR_TORRENT_DIR/$1/$F" "$DEST_DIR/$1"
@bulljit
bulljit / tranmissionIphone.sh
Created January 23, 2011 00:16
Transmission-Daemon Script: Notify Iphone of completed torrent via Prowl
#!/bin/sh
curl -k https://prowl.weks.net/publicapi/add -F apikey=[replace with your growl API key] -F priority=-1 -F application="Transmission" -F description="$TR_TORRENT_NAME completed on $TR_TIME_LOCALTIME"
# /bin/curl -k -F apikey=[your Prowl API key here] -F application=Transmission -F event="Download Complete" -F description="$TR_TORRENT_NAME completed on $TR_TIME_LOCALTIME" https://api.prowlapp.com/publicapi/add
@bulljit
bulljit / transmissionSleepWake.sh
Created January 23, 2011 00:08
Transmission-Daemon Script: Pause & Resume Torrents
#!/bin/sh
NETRC=~/.netrc.transmission
TR="transmission-remote -N $NETRC" # command + authentication
FILE="lastrunning.list"
# accepts arguments -sleep -wake
if [ -z "$1" ]; then
echo usage: $0 -sleep or -wake
exit
@bulljit
bulljit / transmissionUpdateBlocklist.sh
Created January 23, 2011 00:00
Transmission-Daemon: Update Blocklist
#!/bin/bash
# blocklist directory
BLOCKLISTDIR=/var/lib/transmission-daemon/info/blocklists
cd ${BLOCKLISTDIR}
if [ $? -eq 0 ]; then
if [ -f level1 ]; then
rm level1
fi
@bulljit
bulljit / removecompletedtorrents.sh
Created January 22, 2011 23:17
Transmission-Daemon: Remove Completed Torrents
#!/bin/sh
# script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here…
MOVEDIR=/home/mjdescy/media # the folder to move completed downloads to
# …or set MOVEDIR using the first command-line argument
# MOVEDIR=%1
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line