mail from script owned by system

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

mail from script owned by system

Postby zeke » Sat Jan 05, 2013 5:17 pm

I am trying to get motion to send an email using mailx in a script run when a motion event is detected.

I am using the followin config files:
mail.rc:
$this->bbcode_second_pass_code('', 'set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"
')
msmtprc:
$this->bbcode_second_pass_code('', '#Gmail account
defaults
logfile ~/msmtp.log

account gmail
auth on
host smtp.gmail.com
from my_account_here@gmail.com
auth on
tls on
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
user my_account_here@gmail.com
password *******
port 587

account default : gmail
')

I have a copy of each of these files locally (/root/.mailrc & /root/.msmtprc) and system-wide (/etc/mail.rc & /etc/msmtprc)

If I start motion as root from the command line, email is sent as expected.
For my application, I have written a motion.service script that I initiate at boot with systemctl
If I start motion with systemctl, the other part of the event script runs (so I know the script is working), but email is never sent.

I think there must be something simple I am missing. Any ideas?
zeke
 
Posts: 5
Joined: Sat Jan 05, 2013 5:05 pm

Re: mail from script owned by system

Postby WarheadsSE » Sat Jan 05, 2013 5:26 pm

You may need to add an environment file to the service file.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: mail from script owned by system

Postby zeke » Sat Jan 05, 2013 5:36 pm

So would that be
$this->bbcode_second_pass_code('', 'export USER=root')
??
zeke
 
Posts: 5
Joined: Sat Jan 05, 2013 5:05 pm

Re: mail from script owned by system

Postby WarheadsSE » Sat Jan 05, 2013 6:16 pm

Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 42 guests