I entered a first blog on implementing a Surveillance WebCam in the Cloud here:
http://www.jasm.eu/2013/03/17/raspberry ... the-cloud/
I thought to share this with everyone, as I myself also learned a lot from this forum.
Re: Surveillance WebCam in the Cloud
And now, one more entry:
Raspberry Pi – Send and receive (g)Mail
Raspberry Pi – Send and receive (g)Mail
Re: Surveillance WebCam in the Cloud
And one more update:
Raspberry Pi – Client to upload to Dropbox
Raspberry Pi – Client to upload to Dropbox
Re: Surveillance WebCam in the Cloud
Question about the email parser...
I'm running fetchmail -v manually to get debug as I am not receiving the help email..
I'm getting this:
<snip>
fetchmail: IMAP< )
fetchmail: IMAP< A0007 OK Success
fetchmail: IMAP> A0008 FETCH 2 BODY.PEEK[TEXT]
/home/pi/dev/mailParse/parser.sh: line 50: syntax error: unexpected end of file
fetchmail: IMAP< * 2 FETCH (BODY[TEXT] {230}
(230 body octets) ***********
fetchmail: IMAP< )
fetchmail: IMAP< A0008 OK Success
fetchmail: Error writing to MDA: Broken pipe
not flushed
<snip>
I'm not much of a coder but a couple of questions:
1) There isn't a closing } for your sendmail function
2) At the end of the script there are two 'fi' in a row... was this intentional?
Thanks in advance!
pi@raspberrypi ~/dev/mailParse $ vi ~/dev/mailParse/parser.sh
#!/bin/bash
expectedFrom="PigNibEmail@example.com"
expectedFrom2="my_email_Address_2@server.com"
mailHelp() {
sendMail $1 "Help - Possible Commands" "Help"
}
sendMail() {
tmpMail="/var/tmp/mailtxt.txt"
echo "To: "$1 > $tmpMail
echo "From: myPIaccount@gmail.com" >> $tmpMail
echo "Subject: "$2 >> $tmpMail
echo "" >> $tmpMail
echo $3 >> $tmpMail
/usr/sbin/ssmtp $1 $tmpFile
while read x
do
echo $x >> $tmpFile
done
#here we start the actual processing
rightSender=0
sender=""
grep "From:" $tmpFile | grep $expectedFrom > /dev/null
if [ $? -eq 0 ]; then
rightSender=1
sender=$expectedFrom
fi
grep "From:" $tmpFile | grep $expectedFrom2 > /dev/null
if [ $? -eq 0 ]; then
rightSender=1
sender=$expectedFrom2
fi
if [ $rightSender -eq 1 ]; then
task=`grep "Subject:" $tmpFile`
task=${task:9}
task=`echo $task | tr [:upper:] [:lower:]`
echo $task | grep "help" > /dev/null
if [ $? -eq 0 ]; then
mailHelp $sender
fi
fi
rm $tmpFile
I'm running fetchmail -v manually to get debug as I am not receiving the help email..
I'm getting this:
<snip>
fetchmail: IMAP< )
fetchmail: IMAP< A0007 OK Success
fetchmail: IMAP> A0008 FETCH 2 BODY.PEEK[TEXT]
/home/pi/dev/mailParse/parser.sh: line 50: syntax error: unexpected end of file
fetchmail: IMAP< * 2 FETCH (BODY[TEXT] {230}
(230 body octets) ***********
fetchmail: IMAP< )
fetchmail: IMAP< A0008 OK Success
fetchmail: Error writing to MDA: Broken pipe
not flushed
<snip>
I'm not much of a coder but a couple of questions:
1) There isn't a closing } for your sendmail function
2) At the end of the script there are two 'fi' in a row... was this intentional?
Thanks in advance!
pi@raspberrypi ~/dev/mailParse $ vi ~/dev/mailParse/parser.sh
#!/bin/bash
expectedFrom="PigNibEmail@example.com"
expectedFrom2="my_email_Address_2@server.com"
mailHelp() {
sendMail $1 "Help - Possible Commands" "Help"
}
sendMail() {
tmpMail="/var/tmp/mailtxt.txt"
echo "To: "$1 > $tmpMail
echo "From: myPIaccount@gmail.com" >> $tmpMail
echo "Subject: "$2 >> $tmpMail
echo "" >> $tmpMail
echo $3 >> $tmpMail
/usr/sbin/ssmtp $1 $tmpFile
while read x
do
echo $x >> $tmpFile
done
#here we start the actual processing
rightSender=0
sender=""
grep "From:" $tmpFile | grep $expectedFrom > /dev/null
if [ $? -eq 0 ]; then
rightSender=1
sender=$expectedFrom
fi
grep "From:" $tmpFile | grep $expectedFrom2 > /dev/null
if [ $? -eq 0 ]; then
rightSender=1
sender=$expectedFrom2
fi
if [ $rightSender -eq 1 ]; then
task=`grep "Subject:" $tmpFile`
task=${task:9}
task=`echo $task | tr [:upper:] [:lower:]`
echo $task | grep "help" > /dev/null
if [ $? -eq 0 ]; then
mailHelp $sender
fi
fi
rm $tmpFile
Re: Surveillance WebCam in the Cloud
1. Right now I'm not next to my PI, so I cannot cross check the source; But you could be right; Try to add a } at the end of the script, after "rm $tmpFile". I probably have to find a better way to paste code into the Wordpress blog, as sometimes some characters get lost during copy / paste.
2. Yes, I think the 2 fi are fine; One if for checking for "help" in the subject and the other one is for the "if [ $rightSender -eq 1 ]; then" above. (Indentation is another aspect which gets lost during copy / paste, and the code is thus less readable)
2. Yes, I think the 2 fi are fine; One if for checking for "help" in the subject and the other one is for the "if [ $rightSender -eq 1 ]; then" above. (Indentation is another aspect which gets lost during copy / paste, and the code is thus less readable)
Re: Surveillance WebCam in the Cloud
I'm also getting the
Even if I comment everything inside the parser.sh
I am trying to understand what the MDA "needs" at minimum to work.
Code: Select all
fetchmail: Error writing to MDA: Broken pipe
not flushed
I am trying to understand what the MDA "needs" at minimum to work.
Re: Surveillance WebCam in the Cloud
@pignib: Ok now ?
@sesam: the point with the missing } could be relevant for the issue you mentioned, too.
@sesam: the point with the missing } could be relevant for the issue you mentioned, too.
-
- Posts: 35
- Joined: Tue Aug 07, 2012 4:37 pm
Re: Surveillance WebCam in the Cloud
Hey!
I'm also having trouble with the "Broken Pipe". I copied the code from the article and added the "}".
This is the error I get:
Have you already found a fix?
Thank you very much!
I'm also having trouble with the "Broken Pipe". I copied the code from the article and added the "}".
This is the error I get:
Code: Select all
1 message for pi@xxxxx.com at imap.xxxxx.com (folder INBOX).
fetchmail: Error writing to MDA: Broken pipe
reading message pi@xxxxx.com@imap.xxxxx.com:1 of 1 (3124 header octets) (2 body octets) not flushed
Thank you very much!
Re: Surveillance WebCam in the Cloud
I adjusted the known page and hopefully no < or > got lost through copy / paste anymore.
Please post an answer here should this still not work fine.
Please post an answer here should this still not work fine.
-
- Posts: 35
- Joined: Tue Aug 07, 2012 4:37 pm
Re: Surveillance WebCam in the Cloud
Hey!
Thanks, that did the trick
Thanks, that did the trick

Re: Surveillance WebCam in the Cloud
Great ! Enjoy ! 

-
- Posts: 1
- Joined: Fri Jun 14, 2013 9:55 am
Re: Surveillance WebCam in the Cloud
I like your webcam scripts. Have to get myself a webcam soon and start experimenting with it. Would be fun if I got an email with the picture of the people ringing my door bell when I'm not at home.
You took a whole lot of trouble creating an application to upload to Dropbox. I'm a great Dropbox fan myself. But for Raspberry Pi cloud storage I use the webdav protocol in combination with a 5 GB free http://www.box.com account.
If you are interested in how I've solved cloud storage please visit http://www.sbprojects.com/projects/rasp ... webdav.php
And a promising new Dropbox like service is http://www.copy.com. They offer 20 GB of free cloud storage if you sign up using this link: https://copy.com/?r=3rv4cR . They've told me they will support webdav in the near future too.
Keep up the good work.
You took a whole lot of trouble creating an application to upload to Dropbox. I'm a great Dropbox fan myself. But for Raspberry Pi cloud storage I use the webdav protocol in combination with a 5 GB free http://www.box.com account.
If you are interested in how I've solved cloud storage please visit http://www.sbprojects.com/projects/rasp ... webdav.php
And a promising new Dropbox like service is http://www.copy.com. They offer 20 GB of free cloud storage if you sign up using this link: https://copy.com/?r=3rv4cR . They've told me they will support webdav in the near future too.
Keep up the good work.
Re: Surveillance WebCam in the Cloud
Thank you @sbprojects for the hint;
And an update to my Surveillance WebCam in the Cloud:
Several improvements I did to make it more stable: http://www.jasm.eu/2013/07/22/raspberry ... rovements/
And an update to my Surveillance WebCam in the Cloud:
Several improvements I did to make it more stable: http://www.jasm.eu/2013/07/22/raspberry ... rovements/