From 9ca0833a48f40c929cbef891aa91745af3b685ce Mon Sep 17 00:00:00 2001 From: Daniel Stein Date: Tue, 27 Jan 2015 15:56:24 +0100 Subject: [PATCH] Examples section added --- README.md | 2 ++ examples/README.md | 8 ++++++++ examples/ssh-notification.md | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/ssh-notification.md diff --git a/README.md b/README.md index 63637e6..b070a23 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ $ make install ## Usage +If you want some real life use cases make sure to check out our [example section](https://github.com/hackherz/pusher/examples/). + ### Basic usage ```bash $ pusher -i 1 "Hello World" # Send Hello World to device-id 1 diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..46875a2 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,8 @@ +# Examples + +This is a collection of examples how you can user pusher. Feel free to contact me or add it yourself if you have a snippet to share. + + +## Server + +- [Notification on SSH login](https://github.com/hackherz/pusher/examples/ssh-notification.md) diff --git a/examples/ssh-notification.md b/examples/ssh-notification.md new file mode 100644 index 0000000..7aced63 --- /dev/null +++ b/examples/ssh-notification.md @@ -0,0 +1,16 @@ +# Notification on SSH login + +Maybe you want to receive a notification every time someone logs into your server. Just post this snippet at the end of your **/etc/profile**. + + +```bash +# SSH-login notification +if [ -n "${SSH_CLIENT}" ] +then + TEXT="$(date "+%Y-%m-%d %H:%M:%S") ssh login to ${USER}@$(hostname -f)" + TEXT+=" from $(echo "${SSH_CLIENT}" | awk '{print $1}')" + pusher -i 297 "${TEXT}" +fi +``` + +Do not forget to change the id (297 in this example) to the one of your own device.