Changes between Version 1 and Version 2 of Plugins/Execute


Ignore:
Timestamp:
06/08/2010 10:56:13 AM (14 years ago)
Author:
konti
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Plugins/Execute

    v1 v2  
    4343    syslog.syslog(arg) 
    4444}}} 
     45 
     46=== Sendemail script === 
     47As a alternative to the notifications plugin you can send your e-mails through the execute script by using the program sendemail. I'll explain in short how to set this up. 
     48 
     49We need to have script to run and the application sendemail installed. 
     50With sendemail it is possible to send e-mails to a smtp server all from one (command)-line. 
     51I'm using ubuntu 9.10. If sendemail is available in your repository sendemail can be installed with the command: 
     52{{{ 
     53sudo apt-get install sendemail 
     54}}} 
     55The following command sends a e-mail: 
     56{{{ 
     57sendemail -s smtp.myisp.com -t myemail@domain.com -f fromemail@domain.com -u "subject" -m "message" 
     58}}} 
     59 
     60Now where going to create the script that utilyzes the sendemail program. The script is named ''torrent_added.sh'' 
     61{{{ 
     62#!/bin/bash 
     63torrentid=$1 
     64torrentname=$2 
     65torrentpath=$3 
     66 
     67subject="Started download new torrent!" 
     68message="$torrentname to $torrentpath" 
     69 
     70echo -e `date`"::Started download torrent:$2 in: $3" with id:$torrentid >> ~/scripts.log 
     71echo -e `sendemail -s smtp.myisp.com -t myemail@domain.com -f fromemail@domain.com -u "Started downloading $torrentname!" -m "Downloading $torrentname to: $torrentpath"` >> ~/scripts.log 
     72}}} 
     73 
     74In line 2,3 and 4 the variables are assigned to more readable variables.  
     75In line 6 and 7 the variables subject and message are filled.  
     76In line 9 the message is being written to (in my case) /var/lib/deluge/scripts.log. 
     77In line 10 the sendemail program is called. Output is also written to the /var/lib/deluge/scripts.log file. 
     78Make sure that you substitute smtp.myisp.com, myemail@domain.com and fromemail@domain.com with your own data! 
     79 
     80the same script can be rewritten to be used with the complete event. This way you will get a e-mail when a torrent is started and finished.