If you’re reading this, you probably own a fancy seedbox.
And you’re probably having fun messing around command line as well.
Or maybe you’re a GUI person? Either way, don’t you wish there was a simpler way to know when a task has been completed on your seedbox?
Something which doesn’t requires you to manually check the server using a terminal or FTP client?
Well, worry not!
This tutorial will guide you on setting up and receiving your notifications on all the platforms. So buckle up and enjoy the ride!
Tools We’ll Be Using:
Pushbulet Account
SSH Commandline / Terminal
Setting up Pushbullet
First, we need a Pushbullet account, which is the service that allows us to receive notifications from our seedbox. So go to https://www.pushbullet.com and then sign up for an account.
After you have logged in, click on Settings and look for the ‘Access Tokens’ heading on the content section.Then Click on ‘Create Access Token’.
Then copy the seemingly gibberish text that appears below it. The purpose of this Access token is to act as an identification number for your Pushbullet account. We will use this
We will use this Access Token to set up the script that sends push messages from our Seedbox.
Next, go ahead and install the Pushbullet apps on your devices and browsers by using the links provided in the Apps section.
Setting up of your Pushbullet is now complete.Let’s now move to the next section and do some shell-fu.
Setting your Seedbox
First and foremost, log in to the Seedbox via SSH. Follow our guide if you are unsure how to accomplish this:
We will be using a simple script that handles sending the notification to your devices using pushbullet API. If that sounds complex, don’t worry.
Simply connect to your seedbox via ssh. And then download the script below to your seedbox using the given terminal command.
wget https://gist.githubusercontent.com/fullmetalsheep/59a9930ddd0ebda992b7b16627bf382d/raw/7dbc3762e1bd69e77287a29f58cdfc2c0f43bf33/push.sh
Now you should see a file called push.sh in your home directory. Next, we need to copy and paste the Access token we generated in the previous section into the script.
To do this, open push.sh in a text editor.
nano ~/push.sh
We need to adjust executable permission on the script by entering:
chmod u+x push.sh
Test the script
Now we will do our final step – testing. While logged via SSH session, test it with this command:
./push.sh TestSubject TestMessageBody
Where the first parameter is the Subject of the message you need to send, and the second one is the Body of that message.
Depending on the device which you’ve configured to, it can be your browser, Android device, you will receive a notification like this:
Going further – set up alias!
Instead of typing the full path to your script, we can set up alias. This is too much work. Instead, let’s set up an alias so we can simply call the script by its name ‘push’ to send a push notification.
Run this line on the terminal in order to do that.
touch ~/.bashrc && echo "alias pushme='~/push.sh'" >> ~/.bashrc; source ~/.bashrc
After the alias is set, test it with:
push "title" "content"
Where: title is a Subject of push notification, and content is a body of the message. Just like an email!
Other uses of Pushbullet
When you are using this service – the sky is a limit. This service can be used for the various things like:
Get notifications on rtorrent actions
Get notified when video encoding is complete
Get notified when a massive unarchiving of files are finished
Get notified when someone log’s in via SSH (requires a bit of shell scripting) etc
Now, whenever you need to get a notification when a task is done.Simply add “&& push “title” “content” to the end of your command.Like this
ping -c 4 rapidseedbox.com && push "pinging " "Pinging Rapidseedbox.complete!"
In this one-liner, push notification will be executed only if first part (ping) is executed successfully.
Or you can apply bash scripting as well. This only basic example which is working on checking exit codes.
#!/bin/bash
ping -c 2 google.com > /dev/null 2>&1
if [ $? -le 1 ]; then
#This block will be executed if command is executed successfully
echo "Success"
push "Script" "Command completed successfully!"
else
#This block will be executed if command failed
echo "Error"
push "Script" "Error while executing"
fi
More resources about terminal multiplexers and shell scripting:
You’ve now completed setting up push notifications on your Seedbox.
We hope you'll enjoy your new Pushbullet integration! 😃
I don't know what to do next...
If you need any assistance, let us know by opening a chat in the lower right hand corner of your screen. We're here to help 😄