aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2015-06-19 13:25:51 +0200
committerGravatar Christian Hesse <mail@eworm.de>2015-06-19 13:25:51 +0200
commitbabb114b66d3bbdbba9faa69bb1fdbae49f20172 (patch)
tree55b926846a74ccc0e3052f38bac40c985df222da
parent390605f72f19c3f5d033a57fd5e98d33fbc0d088 (diff)
downloadjournal-notify-babb114b66d3bbdbba9faa69bb1fdbae49f20172.tar.gz
journal-notify-babb114b66d3bbdbba9faa69bb1fdbae49f20172.tar.zst
update examples and add systemd unit
-rw-r--r--Makefile7
-rw-r--r--README.md13
-rwxr-xr-xdesktop/journal-notify-crit-alert-emerg.desktop (renamed from examples/journal-notify-crit-alert-emerg.desktop)0
-rwxr-xr-xdesktop/journal-notify-dhcpd.desktop (renamed from examples/journal-notify-dhcpd.desktop)0
-rwxr-xr-xdesktop/journal-notify-sshd.desktop (renamed from examples/journal-notify-sshd.desktop)0
-rwxr-xr-xexecute/mail.sh3
-rw-r--r--systemd/journal-notify-sshd.service9
7 files changed, 26 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 9230401..e3d117d 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index 52b97a7..96f3bec 100644
--- a/README.md
+++ b/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