View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 30 posts ] 
Go to page Previous  1, 2

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Thu Oct 25, 2007 2:22 pm 
Offline
Joined: Fri Oct 20, 2006 12:04 pm
Posts: 905
Location: LA, CA
khrusher wrote:
for the Cron bits.....

Remember that cron entries do not run in the same environment as your login shell. If you are expecting a environment var to be set, you need to set it yourself. One such var that often is assumed is the PATH.

You didnt supply your crontab entry, but I wonder if you included /usr/local/bin/ in the statement, if not, cron prbably cant find sendEmail.

To check for errors in a cron job, you need to capture stdout and stderr.

Code:
0 * * * * /usr/local/bin/sendEmail (otherparms) > /tmp/cron.out 2> /tmp/cron.err


Thanks for the tips. The error from crontab is the same as the bad interpreter: permission denied above. Here's the crontab entry. I've also tried not entering a user and user root.

Code:
13 * * * * mythtv /usr/local/bin/sendEmail (otherparms) > /tmp/cron.out 2> /tmp/cron.err


UPDATE - Working. I guess this is a Perl/Bash thing. I needed at add perl before the sendEmail string... ugh.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 2:50 pm 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
Too Many Secrets wrote:
Strangely I can run the above sendEmail script to send email as user mythtv but not as root. I also have not been able to use the script to generate an email via crontab. Neither users mythtv or root will send the email from cron. Seems to be a permissions problems but I can't see where. Here's what it kicks when I run as root:

Code:
bash: /usr/local/bin/sendEmail: /usr/lib/perl: bad interpreter: Permission denied
On my KM boxen /usr/lib/perl is a directory, although I can't imagine it would run as any user if this was the problem.

What do ls -l /usr/lib/perl and ls -ld /usr/lib/perl show you on your system? Does the script work if you change it to /usr/bin/perl instead?

EDIT: Ooops, looks like you beat me to it... /EDIT


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 20, 2007 8:39 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
I can't seem to get sendEmail to work for me. I need to authenticate to send any mail thru my ISP. Here's my commandline. Anyone know what I'm doing wrong?

Code:
sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
My debug output yeilds an unknown command, but I can't figure out what it is.

Code:
mythtv@mythbox-mbe:~$ sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => Connecting to outgoing.verizonn.net:25
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => My IP address is: 192.168.11.2
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 220
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  EHLO mythbox-mbe
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => The remote SMTP server does NOT support TLS :(
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => SMTP-AUTH: Using PLAIN authentication method
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  AUTH PLAIN bunch-of-hash=
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 235
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => User authentication was successful
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  MAIL FROM:<me@verizon.net>
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 500 5.5.1 Unknown command "" specified
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP error code: 500
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: ERROR => Received:        500 5.5.1 Unknown command "" specified

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 20, 2007 11:29 pm 
Offline
Joined: Fri Oct 20, 2006 12:04 pm
Posts: 905
Location: LA, CA
mihanson wrote:
I can't seem to get sendEmail to work for me. I need to authenticate to send any mail thru my ISP. Here's my commandline. Anyone know what I'm doing wrong?

Code:
sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
My debug output yeilds an unknown command, but I can't figure out what it is.

Code:
mythtv@mythbox-mbe:~$ sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => Connecting to outgoing.verizonn.net:25
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => My IP address is: 192.168.11.2
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 220
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  EHLO mythbox-mbe
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => The remote SMTP server does NOT support TLS :(
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => SMTP-AUTH: Using PLAIN authentication method
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  AUTH PLAIN bunch-of-hash=
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 235
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => User authentication was successful
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  MAIL FROM:<me@verizon.net>
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 500 5.5.1 Unknown command "" specified
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP error code: 500
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: ERROR => Received:        500 5.5.1 Unknown command "" specified


Have you tried double quotes for the subject and message? "Test1" instead of 'Test1'


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 21, 2007 12:49 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
Too Many Secrets wrote:
Have you tried double quotes for the subject and message? "Test1" instead of 'Test1'


Yeah, same issue with double quotes. :?

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject: strange!
PostPosted: Thu Oct 30, 2008 12:13 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
Kirk wrote:
Sendemail is probably a quick easy route then.

Code:
apt-get install sendemail
man sendEmail


i'm trying to setup R5.5 for a friend and for some reason this is not working anymore! it tells me:

W: Couldn't stat source package list http://www.debian-multimedia.org stable/main Packages (/var/lib/apt/lists/www.debian-multimedia.org_dists_stable_main_binary-i386_Packages) -stat (2 No such file or directory)
W: You may want to run apt-get update to correct these problems
E: Couldn't find package sendemail

should i listen to it and do apt-get update first?????

thanks!!!!


Top
 Profile  
 
 Post subject: Re: strange!
PostPosted: Thu Oct 30, 2008 12:45 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
never mind. i did it by hand.
Code:
su -
cd /tmp
wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz
tar -zxvf sendEmail-v1.55.tar.gz
cp sendEmail-v1.55/sendEmail /usr/local/bin
chmod +x /usr/local/bin/sendEmail


Top
 Profile  
 
PostPosted: Thu Oct 30, 2008 1:43 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
new issue! i would like the machine to email me when it shuts down, telling me when it will be back up. i'm guessing i should insert the line:

sendEmail -f from_email -t to_email -s smtp_server -xu from_username -xp password -u 'MythTV is shutting down NOW..' -m 'Will be back on $waketime' >/dev/null

into the file:

/usr/local/bin/mythwelcome-set-alarm.sh

but where do i put the line and what should the format be like? (that file is a perl script)

i'm using R5.5


Top
 Profile  
 
PostPosted: Thu Oct 30, 2008 3:02 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
fra wrote:
i'm guessing i should insert the line:

sendEmail -f from_email -t to_email -s smtp_server -xu from_username -xp password -u 'MythTV is shutting down NOW..' -m 'Will be back on $waketime' >/dev/null

into the file:

/usr/local/bin/mythwelcome-set-alarm.sh

but where do i put the line and what should the format be like? (that file is a perl script)


If you look in the script, you will see several system("..."); lines. That is how you execute a command. Just put the command above in a system("..."); call. I suggest you put it above the IF statement.

You don't need to know a language to code in it.... You just need enough existing code to emulate. :lol:

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
PostPosted: Thu Oct 30, 2008 8:26 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
alien wrote:
If you look in the script, you will see several system("..."); lines. That is how you execute a command. Just put the command above in a system("..."); call. I suggest you put it above the IF statement.

You don't need to know a language to code in it.... You just need enough existing code to emulate. :lol:


i know exactly what you're saying :) the problem is that doing it that way
didn't seem to work. though i now notice i forgot a ;
i'll try again later and will report!!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2008 9:07 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
Yeah, perl can be picky about ;'s

If you haven't already done so, testing from the command line often provides interesting error messages that may not be seen when it is called on shutdown.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2008 9:37 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
alien wrote:
Yeah, perl can be picky about ;'s

If you haven't already done so, testing from the command line often provides interesting error messages that may not be seen when it is called on shutdown.


duh! didn't think of just creating a perl script with just that line!!!!!
i guess that's what happens when it is 3am....

i bet it will work now. i'll check it out when i get home.
thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2008 11:51 am 
Offline
Joined: Fri Sep 07, 2007 11:57 pm
Posts: 166
alien wrote:
Yeah, perl can be picky about ;'s

If you haven't already done so, testing from the command line often provides interesting error messages that may not be seen when it is called on shutdown.


indeed. that worked. i had to add some \ before characters like ^ and $ and @. so the code looks like:

Code:
system("echo 'Will be back on: ' > /tmp/message.txt");
system("date -d '1970-01-01 UTC $waketime sec' +\%A', '\%B' '\%d' '%Y', at '\%H:\%M:\%S' '\%Z >> /tmp/message.txt");
system("echo ' ' >> /tmp/message.txt");
system("lynx -dump http://localhost:6544 | sed -n '/\^Schedule\$/,/\^Job Queue\$/p' | sed '/\^Job Queue\$/d' >> /tmp/message.txt");
system("lynx -dump http://localhost:6544 | sed -n '/\^Machine information\$/,/\^References\$/p' | sed '/\^References\$/d' >> /tmp/message.txt");
system("sendEmail -f from_username\@from_domain -t to_username\@to_domain -s from_smpt_server:port -xu from_username -xp password -u 'MythTV is shutting down' -o message-file=/tmp/message.txt > /dev/null");


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 24, 2009 8:53 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
mihanson wrote:
I can't seem to get sendEmail to work for me. I need to authenticate to send any mail thru my ISP. Here's my commandline. Anyone know what I'm doing wrong?

Code:
sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
My debug output yeilds an unknown command, but I can't figure out what it is.

Code:
mythtv@mythbox-mbe:~$ sendEmail -vvv -f me@verizon.net -t user@address.net -s outgoing.verizon.net:25 -xu me -xp mypassword -u 'Test 1' -m 'Test 1'
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => Connecting to outgoing.verizonn.net:25
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => My IP address is: 192.168.11.2
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 220
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      220 vms173003pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-6.01 (built Apr  3 2006))
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  EHLO mythbox-mbe
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 250
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      250-vms173003pub.verizon.net, 250-8BITMIME, 250-PIPELINING, 250-DSN, 250-ENHANCEDSTATUSCODES, 250-HELP, 250-XLOOP F71C30A8D08C44CECEAEB5A9291530DB, 250-AUTH PLAIN LOGIN, 250-AUTH=LOGIN, 250-ETRN, 250-NO-SOLICITING, 250 SIZE 20971520
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => The remote SMTP server does NOT support TLS :(
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => SMTP-AUTH: Using PLAIN authentication method
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  AUTH PLAIN bunch-of-hash=
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP success code: 235
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: SUCCESS => Received:      235 2.7.0 PLAIN authentication successful.
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => User authentication was successful
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: INFO => Sending:  MAIL FROM:<me@verizon.net>
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Checking for SMTP success or error status in the message: 500 5.5.1 Unknown command "" specified
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: DEBUG => evalSMTPresponse() - Found SMTP error code: 500
Nov 20 18:41:08 mythbox-mbe sendEmail[17404]: ERROR => Received:        500 5.5.1 Unknown command "" specified


I FINALLY got back to this and I have figured out what the Verizon server did not like about sendEmail. Open up the sendEmail script in your favorite text editor and surf down to line 102.
Code:
my $CRLF        = "\015\012";
and change it to this:
Code:
my $CRLF        = "\n";
and you should have a better experience! :lol:

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 25, 2009 3:05 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
Actually, I'm no longer using sendEmail after I discovered how to get normal sendmail to work with an ISP account:

http://knoppmyth.net/phpBB2/viewtopic.php?t=19552

The advantage is that this works for tools that use sendmail directly such as cron.

Cheers,

Allen

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ] 
Go to page Previous  1, 2



All times are UTC - 6 hours




Who is online

Users browsing this forum: Google [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu