Short answer
Use um wrapper shell para executar o job, capturar stderr e enviar apenas um resumo curto com nerve send quando houver falha.
O objetivo não é mandar logs completos para o celular. Envie job name, host, exit code, timestamp e link para o dashboard ou 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
Como enviar alerta do GitHub Actions para o celular?
Adicione um step nerve send com if: failure() e armazene NERVE_DSN como GitHub Actions secret.
O sender DSN consegue ler alertas antigos?
Não. O sender DSN só pode enviar encrypted signals para um pipe.
Preciso rodar o agent para receber alerts?
Não. O agent é opcional e serve para ações assinadas em uma máquina confiável.