🚧Comunicaciones servidor-móvil
Pushover
Características principales:




🚧 Ntfy
🚧 Gotify

Última actualización





Última actualización
sudo nano pushover_app.sh#!/usr/bin/env bash
# Este script mandará notificaciones a nuestro movil siguiendo la API
# Establecemos las variables:
_token='YOUR-API-TOKEN-HERE'
_user='YOUR-USER-KEY-HERE'
# Crearemos una función de bash para mandar notificaciones:
push_to_mobile(){
local t="${1:-cli-app}"
local m="$2"
[[ "$m" != "" ]] && curl -s \
--form-string "token=${_token}" \
--form-string "user=${_user}" \
--form-string "title=$t" \
--form-string "message=$m" \
https://api.pushover.net/1/messages.json
}
curl -s \
--form-string "token=aapnufyw99mwusvntmfygojq5abnmg" \
--form-string "user=ux8v6ivs1zjguy9cfm76hcedzyyazi" \
--form-string "title=hola" \
--form-string "message=marumba" \
https://api.pushover.net/1/messages.jsonsource pushover_app.shpush_to_mobile "bash-notification" "This is a test. Job foo failed on $HOSTNAME @ $(date)"#!/usr/bin/bin bash
# Variables del mail
subject="rsnapshot backup job failed at $HOSTNAME"
log_file="/path/to/my.log.txt"
from="webmaster@cyberciti.biz"
to="webmaster@cyberciti.biz"
# Arrancar diariamente un backup y generar un log
/usr/bin/rsnapshot daily 2>&1 | /root/bin/rsnapreport.pl > "${log_file}"
# Coger errores
status=$?
alogs="$(grep -E -wi '^ERROR:|ERROR|WARNING|WARNING:' $log_file)"
# Si falla, notificame
if [ $status -ne 0 ] || [ "$alogs" != "" ];
then
mail -A "$log_file" -s "$subject" -r "$from" "$to" <<< "Backup script failed with error. Check attached log file"
fi