Short answer
Usa un wrapper shell para ejecutar el job, capturar stderr y enviar solo un resumen corto con nerve send cuando falle.
La idea no es mandar logs completos al teléfono. Envía job name, host, exit code, timestamp y un link al dashboard o runbook.
Wrapper script
#!/usr/bin/env sh
set -u
export NERVE_DSN="nerve://TOKEN:[email protected]"
LOG="/tmp/backup-cron.log"
if ! /opt/backup.sh >"$LOG" 2>&1; then
{
echo "cron failed: backup"
echo "host=$(hostname)"
echo "time=$(date -Is)"
tail -20 "$LOG"
} | nerve send --severity critical
fi
Crontab
0 2 * * * /usr/local/bin/backup-with-alert.sh
VPS and server checks
The same pattern works for disk space checks, SSL expiry checks, database backup jobs, systemd service health, and small VPS monitoring scripts.
Noise control
Add a cooldown if a job can fail repeatedly. One useful phone alert is better than fifty duplicate notifications while the same service is down.
Security boundary
FAQ
Cómo envío una alerta de GitHub Actions al móvil?
Añade un step nerve send con if: failure() y guarda NERVE_DSN como GitHub Actions secret.
El sender DSN puede leer alertas antiguas?
No. El sender DSN solo puede enviar encrypted signals a un pipe.
Necesito correr el agent para recibir alerts?
No. El agent es opcional y sirve para acciones firmadas en una máquina confiable.