[systemd-devel] Restart and RestartSec in packaged .service files
lennart at poettering.net
Thu Sep 1 07:26:56 PDT 2011
On Thu, 01.09.11 16:25, Lennart Poettering (lennart at poettering.net) wrote:
> On Thu, 01.09.11 13:07, Reindl Harald (h.reindl at thelounge.net) wrote:
> > > and at the same time take other action like potentially trigger abrt to send bug report or
> > > revert changes and restart the daemon etc. as opposed to pipe a simple mail notification
> > > to root and systemd provides exactly that to admins via OnFailure= see man systemd.unit
> > > for details...
> > http://0pointer.de/public/systemd-man/systemd.unit.html does not contain the word "mail"
> > "RestartNotifyMail=root" would be what is needed in SOHO environments!
> > well but a) there are missing options and b) OnFailure is simply a joke
> > if i say "Restart=always" then OnFailure is NOT triggered
> if this is the case, then this should be considered a bug I
> guess. Please file it.
> > if i say "Restart=always" i want a mail if this happens
> > not a own unit-file
> write a unit file that sends a mail, something like this:
> send-mail-on-failure at .service:
> Description=Send mail on failure of %I
> ExecStart=/path/to/my/script.sh %I
> echo "$1 crashed, do something, sir!"
> echo "here's the systemctl status output:"
> systemctl status "$1"
> ) | mail lennart -s "OMG! PONIES!"
> And then add OnFailure=send-mail-on-failure@%P to your units where you
> want a mail to be sent.
"OnFailure=send-mail-on-failure@%P.service" I meant. Sorry for the
All untested, but you get the idea...
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel