You are not logged in.
Hi,
I have successfully set up a systemd.timer to start my backup service.
Now I try to execute my backup script which starts rsync with hardlink feature to create an historical backup.
The script executes fine but I want to get the output via mail.
Using this command in terminal executes fine and logs to stdout and sends the mail.
/bin/bash -c '/usr/local/bin/backup.sh /srv/data/ /srv/backup/Archive/ | tee >(/usr/bin/mail -S sendwait -s "Arch Media Data Backup" myemail@bla.com)'
Using it in a execStart section of the service just logs the stdout to journalctl but does not send an mail.
I do not know why.
Any ideas?
Offline
How about /usr/bin/tee instead of tee?
You could set LogLevel=debug in /etc/systemd/user.conf
Offline
I was recently doing something very similar with a similar error (no mail sent when used in systemd unit), but using sendwait fixed it for me. Make sure your implementation of mail actually implements sendwait--e.g. GNU's mail accepts sendwait for compatibility reasons, but doesn't actually implement it.
Also, I think your use of tee is superfluous. Tee redirects stdin to stdout as well as to a file you specify as an argument. Piping to tee and redirecting its stdout effectively does nothing.
Last edited by chapatt (2016-03-01 18:40:56)
Offline