0

I have a linux computer (ubuntu) at some remote location and some scripts to automate things. Then another script will check whether the tasks have been completed. The final step is where i am having problem because I would like to write a script that can send me a notification/alert/update on a web, which I can check later using my smartphone or a windows/linux computer. The script just have to output "Completed" or "Fail"

I have read on several approaches: using email, websockets, push notifications to smartphone and SSH. Is there anything that can be done from the linux terminal that can achieve this task?

SSH: I am having problem connecting to that pc from external network/remote location. Email: I do not prefer this approach because of the vulnerability of having my username and password in the script. Push notification on Smartphone & Websocket: I am still reading on this.

0

If the information "completed" or "fail" isn't very confidential, you could use a commandline chat tool. For example an XMPP client like mcabber. In this case you need a corresponding online account. Maybe take a look at mcabber.

To use email your username/password don't have to be necessarily inside your script. If you manage the linux server you may install an local mailserver (postfix, exim4, ...) and use the local mail command. But if someone else manages this server your password still resides (root) available in config file.

If you don't mind to purchase an additional (cellular) sim card, there is a possibility to send an WhatsApp message via commandline: see yowsup on github. As far as I remember the sim card must not have been used for any phone number before so it can be registered by the script. But you have to figure out yourself, because I just remember this project but never used by myself.
This is an article from the linux magazine which descibes the way to register the sim card. Maybe you have access to this magazine?

Hope this post is helpful to you ...

  • Thanks for the suggestion. For suggestion number 1, do you think it will encounter the same problem as SSH, as I stated above? When I was on the same network, I was able to SSH between the 2 computers. However, once I am outside the office building and using the internet at my home, I was not able to SSH to the computer at the office. So I was wondering if mcabber would be able to overcome that? – goddar Jul 26 '17 at 14:24
  • I assume your office network is a private network behind router/firewall - from internet point of view. So routing inside this network is fine. If your home computer is not connected via VPNn nor the firewall/router supports port forwarding either, the home network does not know how to route the packages: no access to your server at all. If the mcabber client can connect to the internet sending notifications is possible. – ChristophS Jul 27 '17 at 9:19
  • Is there any particular reason for recommending mcabber instead of other xmpp clients? I saw there are lots of them. Thanks. – goddar Jul 29 '17 at 1:04
1

I made myself a notification system from Linux to smartphone using Pushbullet.

You have to:

  1. Install Pushbullet on your smartphone and create an account

  2. Using the same account, create a token on the Pushbullet API

  3. Create a script that using the token sends a notification. In bash it's as simple as this :

      curl --header 'Access-Token: <your_access_token_here>' \
           --header 'Content-Type: application/json' \
          --data-binary '{"body":"Space Elevator, Mars Hyperloop, Space 
          Model S (Model Space?)","title":"Space Travel Ideas","type":"note"}' \
          --request POST \
          https://api.pushbullet.com/v2/pushes
    

4 . You'll receive the notification on your smartphone through the Pushbullet app.

  • Thanks for the suggestion. I will definitely try it. However, if I would like to try to develop the system myself, instead of push notification to an app on smartphone, can it do update on a website instead? I am good at developing website but not so much on developing app. – goddar Jul 26 '17 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.