Forget Email! Push your System Script messages direct to your phone

Being a Linux admin can be very challenging. You’ve got lots of servers that are mission-critical, and you can’t afford to have a single second of downtime. So you’ve done what everyone else has done before; set up lots of scripts to monitor your systems and ensure things are running as smooth as possible, sending you email notifications that slowly start to fill your inbox. After a while, you subconsciously begin to ignore the many emails that fill your inbox before you’ve had your first sip of coffee in the morning – that’s when disaster strikes.

We’ve all been there; accidentally missing that email saying the log folder was getting full, or a service failed to restart or even worse, the backup did not complete.

In the ocean of emails we receive on a daily basis, its easy for repetitive emails to get lost, and even if we did see them, it could have been a while since the messages were sent.

In a mission-critical environment, every extra second you have to prevent something going wrong is priceless – and that’s why we need a faster and better alternative to email.

Say Hello to Push

Push Notifications have been around for a very long time (Since the early 2000’s) and have become more integrated into our daily lives; with everything from social media to banking apps letting us know when something happens.

It’s a fantastic technology that can send us a notification that arrives on our phones within milliseconds. So why not use these instant alerts to tell us the most critical stuff about our server.

What is SimplePush? is a new service that wants to make Push Notifications as simple as can be for programmers, sys-admins and anyone else who can work out how to use their beautifully simple API only system.

It requires no registration, can support encrypted messages and only has a one-time fee of $5 with no recurring monthly costs.

So how does it all work?
All you need to do is install the app on your android phone (iOS app coming soon), and you are ready to go. Once you open the app, you will see a Unique “Key” written at the top that enables the communication between the server and the client (your phone).
To test that everything is working just open a browser and type in the following to the address bar: Title/And Message

This is your first message so choose something cool to send yourself.

Now that you’ve seen how easy SimplePush is, let’s talk about one of its features that makes it great for sys-admins; Events.

Events in SimplePush are a simple way to customise vibration patterns (how many for how long) and ringtones for different types of push notifications. You could have five long vibrations with a loud alarm sound for supercritical messages, and a softer (or even silent) sound and vibration pattern for the typical system status messages.

Let’s configure a few examples and test them out.

Touch the menu button located in the top left then select Events

Now tap the plus symbol in the top right.

Each Event needs and Event ID which is how you will be telling the Push Notification how it should alert you.

For this example let’s choose something meaningful like SOS.

Now choose a vibration pattern you feel will alert you – be sure to also try out the “Wild Thing” and “Increasing.”

Next, Choose an alert sound that will capture your attention.
Great, leave the box called “Disable Notifications” unchecked and click add.

Perfect, you’ve just added the first one, now let’s add a second Event that’s just a lot calmer.

Time to test it all out. Add /event/Your_Event_Nameto the end of the URL we used in the first example like this: Title/And Message/event/SOS

When you receive a notification, you can open it to see exactly when it was sent and which Event ID was used.

So we’ve tested SimplePush, create some Events, now its time to get it working on our Linux Server.

SimplePush has some great libraries that allow you to use the service with many programming languages including code specific to Arduino.

Luckily for us, they included Bash in the list of libraries, so pull their script from GitHub.

If you don’t have git installed, you can do it using the following command:

sudo apt install git

Now let’s clone the script

git clone

We need to move the script somewhere easily accessible and make it executable so run the following commands.

cd send-encrypted
sudo cp /usr/local/bin
cd /usr/local/bin
sudo chmod +x

Ok, so the file can be accessed from anywhere in the system, so let’s see how to use it. -k <key> -p <password> -s <salt> -t <title> -m <message> -e <event>

NOTE: The event must come at the end, there is an error in the usage example of the file. Devs have been notified.

There are a few extra things there we haven’t seen before, and they’re to do with the encryption. So open your app up again and let’s get the “Password” and “Salt” ready for some testing.

Tap the menu button and select Encryption

Now set yourself a password – it’s best to use a long and secure password for this so use a password generator and keep a copy of the password somewhere safe.

Below the password field, you can see the “Salt” which you can write down temporarily.

Ok, now let’s try to send an encrypted message from the Linux box, We’ll use my settings as an example. -k aSbHzq -p 1234 -s v6167ppb -t "Top Secret Mission" -m "This message will self-destruct in 10... 9... 8... 7... 6..." -e SOS

As you can see from the message, there is a small Lock Icon indicating it was an encrypted message.

That’s all there is to it, now add the code to your scripts, and you’re all ready to go!

By | 2017-10-16T14:00:19+00:00 October 16th, 2017|Uncategorized|0 Comments

About the Author:

Leave A Comment