Author |
Message |
daveycanuck
|
Posted: Sat Jan 14, 2006 11:18 pm |
|
Joined: Thu Jan 05, 2006 2:13 pm
Posts: 7
Location:
Ottawa, Ontario
|
I've got my Myth box setup to send me a daily email listing of each days shows that it has recorded. I'm leveraging 'sendEmail.pl" which is available here ( http://caspian.dotconf.net/menu/Software/SendEmail/).
Here is my shell script that pulls the data from Mysql and pushes the email. It doesn't require a local SMTP server or any other whacky dodads. I just sends the mail to my ISP mailbox. Easy as pie.
#! /bin/bash
echo "<html><body>" > /usr/src/sendemail/today.txt
mysql -H mythconverg < /usr/src/sendemail/dumptoday.sql >> /usr/src/sendemail/today.txt
echo "<br><br><a href=http://insertmythIPornamehere/mythweb/recorded_programs.php>See the full listing of recorded programs</a>" >> /usr/src/sendemail/today.txt
echo "</body></html>" >> /usr/src/sendemail/today.txt
perl /usr/src/sendemail/sendEmail.pl -f "Our DVR <insert suitable from address here>" -t insertTOemailaddresshere -u "Today's Shows" -s insertISPserveraddresshere -xu insertISPauthcredentialshere(opt) -xp insertISPpasswordhere(opt) -o message-file=/usr/src/sendemail/today.txt
The dumptoday.sql looks like this:
select title,starttime,description from recordedprogram where date_sub(curdate(),interval 0 day) <= starttime;
It's a quick and dirty solution so if anyone can improve on it I'd be very happy to reap the benefits.
|
|
Top |
|
|
marc.aronson
|
Posted: Sat Sep 16, 2006 11:46 pm |
|
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location:
California
|
Can somebody post a copy of the sendmail.pl script? I could use it and it's not in the wiki. Thanks!
marc
|
|
Top |
|
|
Too Many Secrets
|
Posted: Mon Sep 24, 2007 10:28 pm |
|
Joined: Fri Oct 20, 2006 12:04 pm
Posts: 905
Location:
LA, CA
|
I've been wanting to do the same as the OP, want to email my ever-updated dynamic IP address to access mythweb while on the road. I don't really want to use dyndns.org as I really don't want my mythbox 'linked' to a url, in fact I like that the ip changes every week or so.
While googling, I found a nice easy script to scan my dns ip and log it, but I can't email to my yahoo account.
Code: #!/bin/bash
wget -O ~/newip checkip.dyndns.org
cmp ~/newip ~/oldip >/dev/null || { mv ~/newip ~/oldip mailx -s "Myth IP changed" me@yahoo.com < ~/oldip }
I've installed mailx from apt-get and it seemed to install ok. However I get the error Code: Can't send mail: sendmail process failed with error code 1 I'm guessing that sendmail isn't setup. Webmin says it can setup sendmail, but I don't want to bork anything.
I've tried the above sendEmail script and that runs with no error, but also no email received.
Is there an easier way to send an email from a command line?
|
|
Top |
|
|
grante
|
Posted: Tue Sep 25, 2007 9:10 am |
|
Joined: Mon Jun 27, 2005 4:42 pm
Posts: 321
Location:
Minneapolis, Minnesota, USA
|
tzlaine wrote: I want to email myself my extremely-frequently-changing dynamic IP address of my at-home network so that I can log in to MythWeb from elsewhere (e.g. work). The easy (and "right") way to do that is to get a domain name from someplace like dyndns.com: http://www.dyndns.com/services/dns/dyndns/Then run a daemon (on any machine inside your NAT/firewall) to update the dyndns server when your IP address changes. I use ddclient: http://ddclient.wiki.sourceforge.net/ There are several other similar client daemons around (for both windows and Unix). Quote: I've written a script that figures out the IP address, and now I want to add a line to the script that will send me the address. I'm used to using pine at work and hotmail for personal stuff, and I tried using plain old "mail", but it doesn't seem to be installed under KnoppMyth and I couldn't find it under the ~1 million replies I got from "apt-cache search mail". So I'm at a loss as to what to use.
I have a regular SMTP/POP account from my ISP that I plan to use; can anyone suggest a simple command-line app for this?
I'd probably recommend mutt if you really insist on going the
e-mail route. You'll also have to install and configure an MTA.
Postfix is easy, ssmtp is even easier.
But, the dynamic dns hostname scheme is designed to solve the
exact problem you're trying to solve.
_________________ Grant
|
|
Top |
|
|
grante
|
Posted: Tue Sep 25, 2007 9:18 am |
|
Joined: Mon Jun 27, 2005 4:42 pm
Posts: 321
Location:
Minneapolis, Minnesota, USA
|
saruman wrote: Here are some answers: - If you want to have access to the Web server on your Myth box, I would suggest: - Enabling https on the web server - Password protecting the directories - Forwarding port 443 (if I remember well) as above
I prefer to expose nothing but ssh. Then you can tunnel
connections through ssh to apache, mysql, the backend, etc. The
setup for accessing stuff remotely is a bit more complex, but
it's more secure since you've only got the one "hole" in wall
to guard. You don't have to worry about exploits in the other
apps: as long as you keep openssh up-to-date with security
patches you're probably OK.
_________________ Grant
|
|
Top |
|
|
Gnarl
|
Posted: Tue Sep 25, 2007 9:32 am |
|
Joined: Mon Feb 16, 2004 7:06 pm
Posts: 309
Location:
Toronto
|
I use exim4 as it used to be installed in KnoppMyth and configured it as a smarthost to use my ISPs SMTP
Code: apt-get install exim4 mailutils dpkg-reconfigure exim4-config You already know how to get your IP so you could just Code: mail -s "subject" youraddy@email.com < /file/to/send or Code: wget -q -O - http://checkip.dyndns.org/ | mail -s "My IP" myaddy@email.com
_________________ KnoppMyth Folding@home
How to setup F@H
F@H Stats Page
|
|
Top |
|
|
grante
|
Posted: Tue Sep 25, 2007 6:57 pm |
|
Joined: Mon Jun 27, 2005 4:42 pm
Posts: 321
Location:
Minneapolis, Minnesota, USA
|
Too Many Secrets wrote: I've been wanting to do the same as the OP, want to email my ever-updated dynamic IP address to access mythweb while on the road. I don't really want to use dyndns.org as I really don't want my mythbox 'linked' to a url, It's not linked to a URL. It's just got a hostname. Quote: in fact I like that the ip changes every week or so. Using dyndns won't alter that fact. Quote: I've installed mailx from apt-get and it seemed to install ok. However I get the error Code: Can't send mail: sendmail process failed with error code 1 I'm guessing that sendmail isn't setup. Webmin says it can setup sendmail, but I don't want to bork anything. You really don't want sendmail. It's horrible to configure. If you want something nice and simple, use ssmtp. If you want something a little more sophisticated (which will queue up outbound e-mail if needed), use postfix, exim or qmail. I find qmail a bit harder to configure that the other two, but they're all a cakewalk compared to sendmail. Quote: Is there an easier way to send an email from a command line?
mail/mailx/mutt + ssmtp is about as simple as it gets.
_________________ Grant
|
|
Top |
|
|
Too Many Secrets
|
Posted: Wed Sep 26, 2007 7:27 am |
|
Joined: Fri Oct 20, 2006 12:04 pm
Posts: 905
Location:
LA, CA
|
grante wrote: Too Many Secrets wrote: I've been wanting to do the same as the OP, want to email my ever-updated dynamic IP address to access mythweb while on the road. I don't really want to use dyndns.org as I really don't want my mythbox 'linked' to a url, It's not linked to a URL. It's just got a hostname. Quote: in fact I like that the ip changes every week or so. Using dyndns won't alter that fact.
Maybe I am misunderstanding something, but the way I see it dyndns.com links (your_current_dynamic_ip) to your_site.dns.com . I just don't like the idea of linking my dynamic ip to a static url. I'd also like the idea of emailing myself what was recorded yesterday and what will be recorded today.
I've been playing with exim and will looking into ssmtp too. Thx
|
|
Top |
|
|
grante
|
Posted: Wed Sep 26, 2007 9:39 am |
|
Joined: Mon Jun 27, 2005 4:42 pm
Posts: 321
Location:
Minneapolis, Minnesota, USA
|
Quote: Quote: Quote: I don't really want to use dyndns.org as I really don't want my mythbox 'linked' to a url, It's not linked to a URL. It's just got a hostname. Quote: in fact I like that the ip changes every week or so. Using dyndns won't alter that fact. Maybe I am misunderstanding something, but the way I see it dyndns.com links (your_current_dynamic_ip) to your_site.dns.com. That's pretty much correct. It sets up a hostname for you in the dyndns DNS servers. URLs are a part of HTTP (the protocol used to serv web pages). Setting up a DynDNS hostname does not create any URL links on any webpages that point to your host (which is what I though you were objecting to). Quote: I just don't like the idea of linking my dynamic ip to a static url.
I guess you're saying you don't want a hostname on a DNS server. That's fine, but it's got little to do with URL links. When you said you didn't want your host linked to a URL, I assume you meant you didn't want any URL links pointing to your host (which DynDNS doesn't do). That's different than not having a hostname. Quote: I'd also like the idea of emailing myself what was recorded yesterday and what will be recorded today.
There's nothing wrong with that (or with not wanting a
hostname). I just misunderstood what it was you didn't want.
_________________ Grant
|
|
Top |
|
|