I have the following service configured:
[Unit]
Description=SCollector
After=NetworkManager.service
[Service]
Type=simple
ExecStart=/bin/sh -c "/opt/scollector/scollector /opt/scollector/collectors || (echo '' | /usr/bin/mail -s 'scollector died' [email protected] && exit -1)"
Restart=on-failure
[Install]
WantedBy=multi-user.target
For some reason, that mail command never sends any mail when the scollector process exits with non-0. This works AOK when run on the command line, /bin/sh call and all. I've captured STDOUT and STDERR of mail, and it is throwing no errors. There is nothing in maillog.
What gives? Why won't it send mail?