I have configured s-nail email notifications and I am able to send the email manually as root. If I attempt to send it as non-root user I get the following odd error:
Account `gmail' does not exist.
No mail for x
x = Linux username. gmail = the account in .mailrc config as per the link above.
I will only really want to send emails as root so this is fine and I understand why it fails but I get the same error when executing identical email command from a shell script via smartd daemon. The only difference is the user name is now root. The error happens whether the script is executed by systemd daemon (logs from journalctl -u smartd).
/etc/smartd.conf
DEVICESCAN -a -m email@gmail.com -M test -M exec /etc/smartmontools/run.d/email -n standby,30 -s (S/../.././18|L/../../5/16)
The email script works fine when executed manually by root from terminal so that should not be the problem.
Edit:
With this added to the scipt the output is just "USER:" with not even a space where the actual username should be printed. I get the username printed when executed manually. When executed manually as after su command, however I still get the username of the pre su command username. Very odd.
echo "USER: "
echo "$USER"
Aucun commentaire:
Enregistrer un commentaire