Backwards

Startup notification

Mini-guide - 05/01/2017

An example script notifying the user when the device starts.


BASH script:


#!/bin/bash
token="TOKEN"
testonoti="Server is ON."
curl --request GET "https://api.rpinotify.it/notification/$token/text/$(echo ${testonoti// /%20})"
						

It works in a very simple way. When the script is executed a notification is sent.
If the script is started on startup....

The variables of the script:

  • $tokenPersonal token assigned during the registration process..
  • $testonotiText notification.

The call HTTP GET structure is very simple.

https://api.rpinotify.it/notification/$token/text/$testonoti

Variable name Description Format
$token Personal token. Alphanumeric string.
$testonoti Notification text. Text without spaces (use %20)

Execute the script on startup

On startup so that a notification is sent.

You can use cron, a very popular tool used to plan operations on linux systems.

For the execution of the script on startup insert the line @reboot sh boot.sh in crontab.



Dove boot.sh is the position of the script in the device.

For the execution of the script authorizations are necessary. Authorizations can be give by entering chmod 755 boot.sh

RpiNotify is an Italian project supported by RaspberryItaly

The first Italian RaspberryPi community.