Generats a e-mail when something happend
Generats a e-mail when something happend
I would like to send a mail when something happend in NetHome.
Example when temp goes low or high or maybe some movement or when a door bell button pushed.
I have config my RPI box so its possible to run command for send mail.
mail -s "Warning from NetHome" xxxxx@xxxxx.xx < message.txt
But how to run this command from NetHome server?
I look at "ValueTrigger" that maybe could use for response if in temp example.
Regards
Fred
Example when temp goes low or high or maybe some movement or when a door bell button pushed.
I have config my RPI box so its possible to run command for send mail.
mail -s "Warning from NetHome" xxxxx@xxxxx.xx < message.txt
But how to run this command from NetHome server?
I look at "ValueTrigger" that maybe could use for response if in temp example.
Regards
Fred
-
- Site Admin
- Posts: 313
- Joined: Sun Nov 30, 2014 2:16 pm
Re: Generats a e-mail when something happend
A ValueTrigger would work fine. The way you specify an external script is to first select action "exec" and then press save. After that you can specify an external command or script as action, for example:
The thing to watch out for is that OpenNetHome is running with a low privileged account, so you have to make sure it has the rights to run the command. You can see some more info in this post: http://nethomeserver.blogspot.se/2014/0 ... ation.html
Code: Select all
exec,/usr/bin/mail -s "Warning from NetHome" xxxxx@xxxxx.xx < /usr/message.txt
Re: Generats a e-mail when something happend
Okay,is there anyone here that can help med and do an newbee guide how to fix the rights for the useraccount to alow it to send mail?
Thanx
/C
Thanx
/C
Re: Generats a e-mail when something happend
Hello!
I tried to send an email with the a command but when I add the command line my input is cleared and only "exec,echo " is left. I would like to run this: "echo "Crawl space to cold!" | mail -s "House Control" name@domain.com". What am I doing wrong?
/Reik
I tried to send an email with the a command but when I add the command line my input is cleared and only "exec,echo " is left. I would like to run this: "echo "Crawl space to cold!" | mail -s "House Control" name@domain.com". What am I doing wrong?
/Reik
Raspberry PI 2 and Tellstick Duo
Re: Generats a e-mail when something happend
Hello again!
Now I managed to not get an error in ONH but the mail is not sent anyway. I cant find anything in any log file. My command look like this:
ssmtp -t < /etc/opt/nethome/DoorBell.txt
If I use it with brackets [ssmtp -t < /etc/opt/nethome/DoorBell.txt] it will generate an error. It works nice from the commandline. Any idea anyone? Where can I find information about what is going wrong? In the mail logs is nothing...
/Reik
Now I managed to not get an error in ONH but the mail is not sent anyway. I cant find anything in any log file. My command look like this:
ssmtp -t < /etc/opt/nethome/DoorBell.txt
If I use it with brackets [ssmtp -t < /etc/opt/nethome/DoorBell.txt] it will generate an error. It works nice from the commandline. Any idea anyone? Where can I find information about what is going wrong? In the mail logs is nothing...
/Reik
Raspberry PI 2 and Tellstick Duo
Re: Generats a e-mail when something happend
Hello again!
Is nobody using mail instead of jabber? Which user rights do I need to assign to nethome to be able to send mails?
/Reik
Is nobody using mail instead of jabber? Which user rights do I need to assign to nethome to be able to send mails?
/Reik
Raspberry PI 2 and Tellstick Duo
Re: Generats a e-mail when something happend
Hi room!
Now I have been struggling with sending mail for a while. I can't find anything in any log. If the command is not correct I get an error but when I use the correct syntax (works with putty logged in as pi) nothing happens. No error no mail... Does anybody have suggestion where to look?
/Reik
Now I have been struggling with sending mail for a while. I can't find anything in any log. If the command is not correct I get an error but when I use the correct syntax (works with putty logged in as pi) nothing happens. No error no mail... Does anybody have suggestion where to look?
/Reik
Raspberry PI 2 and Tellstick Duo
Re: Generats a e-mail when something happend
Another question...
If I would try to login as nethome with putty to test the mail sending. What is is the password of the nethome user?
/Reik
If I would try to login as nethome with putty to test the mail sending. What is is the password of the nethome user?
/Reik
Raspberry PI 2 and Tellstick Duo
-
- Site Admin
- Posts: 313
- Joined: Sun Nov 30, 2014 2:16 pm
Re: Generats a e-mail when something happend
The nethome user does not have a password, since it is not really intended for a human user. You can switch to the account using the "su" command like this:
Then you will be acting as the nethome user. To go back to the original user you just type:
Code: Select all
sudo su nethome
Code: Select all
exit
Re: Generats a e-mail when something happend
Thanks Stefan!
I'm not a linux specialist as you see . Sending mail as nethome user works fine. How ever, I still don't get any mail from the server. Do you have any suggestion?
/Reik
I'm not a linux specialist as you see . Sending mail as nethome user works fine. How ever, I still don't get any mail from the server. Do you have any suggestion?
/Reik
Raspberry PI 2 and Tellstick Duo