source: trunk/extras/send-email-when-torrent-done.sh

Last change on this file was 10649, checked in by charles, 7 years ago

(trunk) sample script to send an email or SMS message when a torrent finishes downloading

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/sh
2
3##
4##  User-configurable Variables
5##
6
7# Where "nail" is installed on your system.
8# We need this to actually send the mail, so make sure it's installed
9NAIL=/usr/bin/nail
10
11# REQUIRED CHANGE #1: you must set SMTP_SERVER
12# http://www.host45.com/resources/ispsmtps.php has a list of ISP's smtp servers
13SMTP_SERVER=your.smtp.server
14
15# REQUIRED CHANGE #2: you must set your email address.
16# option A: change "yourname@yourmail.com" here and remove the leading '#' to
17# use a real email address
18#TO_ADDR=yourname@yourmail.com
19#
20# option B: for an SMS message, set your phone number here and remove the
21# leading '#' on the PHONENUM line and your phone provider's TO_ADDR line
22#PHONENUM="1234567890"
23#TO_ADDR="$PHONENUM@message.alltel.com"      # SMS: Alltel
24#TO_ADDR="$PHONENUM@txt.att.net"             # SMS: AT&T (formerly Cingular)
25#TO_ADDR="$PHONENUM@myboostmobile.com"       # SMS: Boost Mobile
26#TO_ADDR="$PHONENUM@sms.mycricket.com"       # SMS: Cricket Wireless
27#TO_ADDR="$PHONENUM@messaging.nextel.com"    # SMS: Nextel (Sprint Nextel)
28#TO_ADDR="$PHONENUM@messaging.sprintpcs.com" # SMS: Sprint (Sprint Nextel)
29#TO_ADDR="$PHONENUM@tmomail.net"             # SMS: T-Mobile
30#TO_ADDR="$PHONENUM@vtext.com"               # SMS: Verizon
31#TO_ADDR="$PHONENUM@vmobl.com"               # SMS: Virgin Mobile USA
32#TO_ADDR="$PHONENUM@txt.bellmobility.ca"     # SMS: Bell Canada
33#TO_ADDR="$PHONENUM@cwemail.com"             # SMS: Centennial Wireless
34#TO_ADDR="$PHONENUM@csouth1.com"             # SMS: Cellular Sout
35#TO_ADDR="$PHONENUM@gocbw.com"               # SMS: Cincinnati Bell
36#TO_ADDR="$PHONENUM@mymetropcs.com"          # SMS: Metro PCS 1
37#TO_ADDR="$PHONENUM@metropcs.sms.us"         # SMS: Metro PCS 2
38#TO_ADDR="$PHONENUM@qwestmp.com"             # SMS: Quest
39#TO_ADDR="$PHONENUM@pcs.rogers.com"          # SMS: Rogers
40#TO_ADDR="$PHONENUM@tms.suncom.com"          # SMS: Suncom
41#TO_ADDR="$PHONENUM@msg.telus.com"           # SMS: Telus
42#TO_ADDR="$PHONENUM@email.uscc.net"          # SMS: U.S. Cellular
43
44###
45###  Send the mail...
46###
47
48SUBJECT="Torrent Done!"
49FROM_ADDR="transmission@localhost.localdomain"
50TMPFILE=`mktemp -t transmission.XXXXXXXXXX`
51echo "Transmission finished downloading \"$TR_TORRENT_NAME\" on $TR_TIME_LOCALTIME" >$TMPFILE
52$NAIL -v -S from="$FROM_ADDR" -S smtp -s "$SUBJECT" -S smtp=$SMTP_SERVER "$TO_ADDR" < $TMPFILE
53rm $TMPFILE
Note: See TracBrowser for help on using the repository browser.