diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | README.md | 13 | ||||
-rwxr-xr-x | desktop/journal-notify-crit-alert-emerg.desktop (renamed from examples/journal-notify-crit-alert-emerg.desktop) | 0 | ||||
-rwxr-xr-x | desktop/journal-notify-dhcpd.desktop (renamed from examples/journal-notify-dhcpd.desktop) | 0 | ||||
-rwxr-xr-x | desktop/journal-notify-sshd.desktop (renamed from examples/journal-notify-sshd.desktop) | 0 | ||||
-rwxr-xr-x | execute/mail.sh | 3 | ||||
-rw-r--r-- | systemd/journal-notify-sshd.service | 9 |
7 files changed, 26 insertions, 6 deletions
@@ -29,11 +29,12 @@ install: install-bin install-doc install-bin: journal-notify $(INSTALL) -D -m0755 journal-notify $(DESTDIR)/usr/bin/journal-notify - $(INSTALL) -D -m0755 examples/journal-notify-crit-alert-emerg.desktop $(DESTDIR)/usr/share/journal-notify/examples/journal-notify-crit-alert-emerg.desktop - $(INSTALL) -D -m0755 examples/journal-notify-dhcpd.desktop $(DESTDIR)/usr/share/journal-notify/examples/journal-notify-dhcpd.desktop - $(INSTALL) -D -m0755 examples/journal-notify-sshd.desktop $(DESTDIR)/usr/share/journal-notify/examples/journal-notify-sshd.desktop + $(INSTALL) -D -m0755 desktop/journal-notify-crit-alert-emerg.desktop $(DESTDIR)/usr/share/journal-notify/desktop/journal-notify-crit-alert-emerg.desktop + $(INSTALL) -D -m0755 desktop/journal-notify-dhcpd.desktop $(DESTDIR)/usr/share/journal-notify/desktop/journal-notify-dhcpd.desktop + $(INSTALL) -D -m0755 desktop/journal-notify-sshd.desktop $(DESTDIR)/usr/share/journal-notify/desktop/journal-notify-sshd.desktop $(INSTALL) -D -m0755 execute/echo.sh $(DESTDIR)/usr/share/journal-notify/execute/echo.sh $(INSTALL) -D -m0755 execute/mail.sh $(DESTDIR)/usr/share/journal-notify/execute/mail.sh + $(INSTALL) -D -m0755 systemd/journal-notify-sshd.service $(DESTDIR)/usr/share/journal-notify/systemd/journal-notify-sshd.service install-doc: README.html $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/journal-notify/README.md @@ -77,10 +77,17 @@ your executable understands these options: * *-m*: message Additionally example desktop files are installed to -`/usr/share/journal-notify/examples`. You should copy them to +`/usr/share/journal-notify/desktop/`. You should copy them to `~/.config/autostart/` to enable autostart or create your own desktop files -there. Example execute scripts are installed to -`/usr/share/journal-notify/execute/`. +there. + +Example execute scripts are installed to `/usr/share/journal-notify/execute/`. +Review and update them before execution, for example you should replace the +mail address in `mail.sh` with your own one. + +Example systemd units are installed to `/usr/share/journal-notify/systemd/`. +To use them copy to `/etc/systemd/system/` and `systemctl enable`. Again, make +sure to change unit file and script for your needs! ### Upstream diff --git a/examples/journal-notify-crit-alert-emerg.desktop b/desktop/journal-notify-crit-alert-emerg.desktop index ddcd27f..ddcd27f 100755 --- a/examples/journal-notify-crit-alert-emerg.desktop +++ b/desktop/journal-notify-crit-alert-emerg.desktop diff --git a/examples/journal-notify-dhcpd.desktop b/desktop/journal-notify-dhcpd.desktop index f74b67a..f74b67a 100755 --- a/examples/journal-notify-dhcpd.desktop +++ b/desktop/journal-notify-dhcpd.desktop diff --git a/examples/journal-notify-sshd.desktop b/desktop/journal-notify-sshd.desktop index efedcbf..efedcbf 100755 --- a/examples/journal-notify-sshd.desktop +++ b/desktop/journal-notify-sshd.desktop diff --git a/execute/mail.sh b/execute/mail.sh index 2d757db..3b797c1 100755 --- a/execute/mail.sh +++ b/execute/mail.sh @@ -19,6 +19,9 @@ while getopts "i:p:m:" opt; do esac done +# WARNING: Do NOT use this unmodified! +# Please replace mail address with your own. + mail -s "[${PRIORITY}] ${IDENTIFIER}" mail@example.com <<< "${MESSAGE}" exit 0 diff --git a/systemd/journal-notify-sshd.service b/systemd/journal-notify-sshd.service new file mode 100644 index 0000000..772fbe2 --- /dev/null +++ b/systemd/journal-notify-sshd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Notify about SSHD journal log entries + +[Service] +Type=simple +ExecStart=/usr/bin/journal-notify -m SYSLOG_IDENTIFIER=sshd -e -r "^(error:|Accepted)" -X /path/to/updated/execute/mail.sh + +[Install] +WantedBy=multi-user.target |