TvL Posted June 6, 2011 Report Share Posted June 6, 2011 Hi community,I really like utserver! Used azureus in the past...I did like the Status Notification Emailer from azureus and tried to recreate it using the finish_cmd and state_cmd feature.So I created my own mailer script in Ruby and thought some of you might like it as well.Here is my utserver config: Yes, the first argument really are 2 single quotes.I am using version utorrent-server-3.0-25053.tar.gz and according to my logfile the first argument is not being sent to my script.I am using the webui version from 2011-05-28 (found in this post: http://forum.utorrent.com/viewtopic.php?id=58156)The mailer script is written in Ruby and therefore you need ruby:apt-get install ruby1.9.1 rubygems1.9.1gem1.9.1 install mail --no-ri --no-rdocSo far the dependencies, now the script (sendmail.rb):#!/usr/bin/ruby1.9.1require 'mail'require 'logger'$log = Logger.new('sendmail.log', 4, 1024*1024) # rotate after 1MB and keep 4 copies$log.datetime_format = '%Y-%m-%d %H:%M:%S'$log.level = Logger::DEBUGif ARGV.length < 3 $log.fatal "Not enough arguments: #{ARGV.inspect}" exit 1endpstate = ARGV.shift.to_icstate = ARGV.shift.to_ititle = ARGV.join(' ')exit(0) if pstate == cstatepindex = pstate - 1cindex = cstate - 1states = Array.newstates << 'error'states << 'checked'states << 'paused'states << 'super seeding'states << 'seeding'states << 'downloading'states << 'super seeding (forced)'states << 'seeding (forced)'states << 'downloading (forced)'states << 'queued seed'states << 'finished'states << 'queued'states << 'stopped'$log.info "title: #{title} went from: #{states[pindex]} to #{states[cindex]}"Mail.defaults do delivery_method :smtp, { :address => '127.0.0.1', :port => 25, :enable_starttls_auto => false }endmail = Mail.new do to "tvl@mailinator.net" from "utorrent@mailinator.net" subject "Status change for '#{title}'" html_part do content_type 'text/html; charset=UTF-8' body %Q|<HTML><HEAD><TITLE>Utorrent download status notification</TITLE></HEAD><BODY><H1>Utorrent download status notification</H1>Download '#{title}' has changed state from #{states[pindex]} to #{states[cindex]}</BODY></HTML>| endendmail.deliver!Don't forget to chmod 755 sendmail.rbAdjustments according to your need:- mailto: currently set to tvl@mailinator.net- mailfrom: currently set to utorrent@mailinator.net- smtphost: 127.0.0.1 port 25 (change that to the mailserver of your ISP or to your own mailserver)- logfile: sendmail.log- ruby interpreter: /usr/bin/ruby1.9.1 I hope you like this EDIT: It seems to me that utserver does not correctly reap it's children. That's why the sendmail script remains as zombie after it has been run. In order to get rid of zombies, the utserver needs to be restarted. It's not a showstopper for me and there's a post about it:http://forum.utorrent.com/viewtopic.php?id=89600 Link to comment Share on other sites More sharing options...
mcdonald Posted June 6, 2011 Report Share Posted June 6, 2011 It seems to me that utserver does not correctly reap it's children. That's why the sendmail script remains as zombie after it has been run. In order to get rid of zombies, the utserver needs to be restarted. It's not a showstopper for me and there's a post about it:http://forum.utorrent.com/viewtopic.php?id=89600Thanks for the second report on this issue. I have not been able to reproduce it. My tests never show zombies being created. Each child process created for state change events is put in a new session via setsid(), so there should be no need for the utserver process to wait on those child processes. Can you tell me more about the environment in which you run uTorrent Server (32-bit or 64-bit, etc.)? Link to comment Share on other sites More sharing options...
TvL Posted June 6, 2011 Author Report Share Posted June 6, 2011 Hi mcdonald, Lets have that discussion in the other topic (http://forum.utorrent.com/viewtopic.php?id=89600) regarding that issue. I will answer your questions there. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.