2023-01-25 01:16:01 +00:00
|
|
|
.\" Automatically generated by Pandoc 2.19.2
|
|
|
|
.\"
|
|
|
|
.\" Define V font for inline verbatim, using C font in formats
|
|
|
|
.\" that render this, and otherwise B font.
|
|
|
|
.ie "\f[CB]x\f[]"x" \{\
|
|
|
|
. ftr V B
|
|
|
|
. ftr VI BI
|
|
|
|
. ftr VB B
|
|
|
|
. ftr VBI BI
|
|
|
|
.\}
|
|
|
|
.el \{\
|
|
|
|
. ftr V CR
|
|
|
|
. ftr VI CI
|
|
|
|
. ftr VB CB
|
|
|
|
. ftr VBI CBI
|
|
|
|
.\}
|
|
|
|
.TH "systemd_failure_notify" "1" "January 2023" "systemd_failure_notify" ""
|
|
|
|
.hy
|
|
|
|
.SH NAME
|
|
|
|
.PP
|
|
|
|
systemd_failure_notify - Notifies via mail or gotify when a service has
|
|
|
|
failed.
|
|
|
|
Configuration is done in environment files.
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
It\[cq]s part of \f[B]system-helpers\f[R].
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.PP
|
2023-01-25 22:27:38 +00:00
|
|
|
\f[B]systemd_failure_notify\f[R] [SERVICE]
|
2023-01-25 01:16:01 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
|
|
|
\f[B]systemd_failure_notify\f[R] executes \f[I]mailx\f[R] or
|
|
|
|
\f[I]gotify\f[R] to send out notifications.
|
|
|
|
It comes with systemd services.
|
|
|
|
Use the provided systemd service in the \f[B]OnFailure\f[R] directive
|
|
|
|
with \f[I]OnFailure=systemd_failure_notify\[at]%n.service\f[R].
|
|
|
|
.PP
|
2023-01-25 22:27:38 +00:00
|
|
|
By default, \f[B]systemd_failure_notify\f[R] tries to read from
|
2023-01-25 01:16:01 +00:00
|
|
|
\f[I]$HOME/.systemd_failure_notify.conf\f[R] and
|
|
|
|
\f[I]/etc/systemd_failure_notify.conf\f[R] for configuration.
|
2023-01-25 22:27:38 +00:00
|
|
|
It will exit with a non-zero exit code if it cannot find a proper
|
2023-01-25 01:16:01 +00:00
|
|
|
configuration file.
|
|
|
|
.PP
|
|
|
|
The following are at least required for the script to work:
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
- \f[B]SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS=\[lq]\[lq]\f[R] which
|
|
|
|
requires \f[I]mail.rc\f[R] to be configured and `\f[I]mailx\f[R]'
|
|
|
|
command has be available\[ac]
|
|
|
|
.PP
|
|
|
|
By default, \f[B]SYSTEMD_FAILURE_NOTIFY_MAIL_ENABLED\f[R] is set to
|
|
|
|
\f[B]true\f[R].
|
2023-01-25 22:27:38 +00:00
|
|
|
Set it to \f[B]false\f[R] to use \f[I]gotify\f[R] only.
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
2023-01-25 01:16:01 +00:00
|
|
|
.PP
|
|
|
|
The following are optional and integrate gotify-cli to send
|
2023-01-25 22:27:38 +00:00
|
|
|
notifications, it defaults to false:
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
- \f[B]SYSTEMD_FAILURE_NOTIFY_GOTIFY_ENABLED=\[lq]true\[rq]\f[R] uses
|
2023-01-25 18:07:14 +00:00
|
|
|
\f[I]gotify\f[R] command which has be available and needs to be properly
|
|
|
|
configured by having a cli.json file.
|
2023-01-25 01:16:01 +00:00
|
|
|
.PP
|
|
|
|
You can copy this script to \f[I]/usr/local/bin\f[R] and use create a
|
|
|
|
custom \f[B]CONFIG_FILE\f[R] as user.
|
|
|
|
.SH EXAMPLE
|
|
|
|
.PP
|
|
|
|
Create a \f[I]$HOME/.systemd_failure_notify.conf\f[R] and add
|
|
|
|
\f[I]SYSTEMD_FAILURE_NOTIFY_MAIL_ADDRESS=\[lq]alias\[at]domain.tld\[rq]\f[R].
|
|
|
|
Notifications will be delivered to alias\[at]domain.tld.
|
|
|
|
Examples can be found in
|
|
|
|
\f[I]/usr/share/doc/systemd_failure_notify\f[R].
|
|
|
|
.PP
|
|
|
|
Then, add \f[B]systemd_failure_notify\[at]serviceName\f[R] in a systemd
|
|
|
|
unit file in the \f[B]OnFailure\f[R] directive:
|
|
|
|
.PP
|
|
|
|
[Unit]
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
OnFailure=systemd_failure_notify\[at]%n.service
|
|
|
|
.PD 0
|
|
|
|
.P
|
|
|
|
.PD
|
|
|
|
.SH EXIT VALUES
|
|
|
|
.TP
|
|
|
|
\f[B]0\f[R]
|
|
|
|
Success
|
|
|
|
.TP
|
|
|
|
\f[B]1\f[R]
|
|
|
|
Error
|
|
|
|
.SH AUTHORS
|
|
|
|
Alexander Sch\[:a]ferdiek.
|