PDA

View Full Version : MTA for TiVo



lrhorer
03-05-2011, 11:04 PM
Has anyone ever compiled a Mail Transfer Agent such as Exim4 or SSMTP for the TiVo? I would like to have my TiVos send out messages when certain events occur, such as a pending upgrade.

Kayle
03-08-2011, 05:53 AM
An MTA is surely overkill here, you just need an SMTP client so it can talk to your mailbox server--unless you mean you actually want your TiVo to be a mail host. Something like the TCL smtp (http://tcllib.sourceforge.net/doc/smtp.html) package ought to work well with a TCL script. I just checked and it doesn't appear to be included with the TiVo TCL installation, but you should be able to pull it out from an official TCL distribution.

A quick check of a unix software packages site found nearly a dozen SMTP clients, many compatible with sendmail command line syntax, some intended to be brain-dead simple to use.

lrhorer
03-08-2011, 01:54 PM
Thanks. I think I will look into it. In the mean time, I was thinking this over, and I came up with a different solution. Instead of mailing from the TiVos, I created an Expect script to run on one of my servers. First, I created this simple script to put on the TiVos:


swversion:

#! /bin/bash
echo mls /SwSystem | tivosh

Then I created a simple Expect script on the server to run the software on the TiVos:


tivotest.exp:

#! /usr/bin/expect --
log_file session.txt
spawn telnet $argv
expect #
send swversion\n
expect #
sleep 2
log_file
send exit

In order to run the Expect script on all three TiVos I create a shell script:

tivoscan:

#! /bin/bash

dir=/usr/share/tivoscan
cd $dir
tivo=$dir/tivos.list
file=$dir/session.txt
log=/var/log/tivoscan.log
expfile=$dir/tivotest.exp

echo $(date +%Y-%m-%d_%H:%M:%S) Starting tivoscan session. >> $log
while read line
do
[ -f $file ] && rm $file
$expfile $line
active=$(grep ACTIVE $file | awk '{print $3;}')
swlines=$(grep tyDb $file | grep -v $active | wc -l)
if [ $swlines -gt 0 ];
then
echo "TiVo $line is ppending a software installation." | mail -a From:mdadm_monitor -s "RAID-Server TiVo Upgrade Notice" <email addresses>
echo $(date +%Y-%m-%d_%H:%M:%S) Emailing notification of pending software for $line. >> $log
fi
done < $tivo
[ -f $file ] && rm $file
echo $(date +%Y-%m-%d_%H:%M:%S) Tivoscan session complete. >> $log

I create a file to contain the hostnames of the TiVos:


tivos.list:

hd_livingroom
hd_theater
tivo_hd

And finally, I create a cron job to run the script every six hours:


0 */6 * * * root /usr/bin/tivoscan > /dev/null

djl
04-10-2011, 04:56 PM
This sounded like a great idea, so I tried it out. To my astonishment, pretty much everything worked right off the bat. You can grab the script here (http://www.dealdatabase.com/forum/showthread.php?p=310518#post310518)if you have any use for it.


Something like the TCL smtp (http://tcllib.sourceforge.net/doc/smtp.html) package ought to work well with a TCL script.