Mini-guide - 03/01/2017
Example script notifying the user when a site (or a server) goes offline.
The call structure HTTP GET is really simple.
|$token||Personal token.||Alphanumeric string.|
|$testonoti||Notification text.||Text without spaces (use %20)|
You can use cron, a very popular tool to plan operations on linux systems. Change contab with
crontab -e. The syntax of the line to add is the following:
* * * * * /command/to/be/executed - - - - - | | | | | | | | | ----- Day of week (0 - 7) (Sunday=0 or 7) | | | ------- Month (1 - 12) | | --------- Day of month (1 - 31) | ----------- Hour (0 - 23) ------------- Minute (0 - 59)
The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month. In this specific example, an asterisk in all fields means run job every minute. We can edit our crontab with
crontab -e and add the line (after last line) about this script.
*/2 * * * * sitestatus.sh
Where /home/gab/sitestatus.sh is the position of the script in the device.
For the execution of the script authorizations are necessary. Authorizations can be given by entering
chmod 755 sitestatus.sh