Short answer
Gunakan shell wrapper untuk menjalankan job, menangkap stderr, lalu mengirim ringkasan singkat dengan nerve send saat gagal.
Jangan kirim full logs ke ponsel. Kirim job name, host, exit code, timestamp, dan link ke dashboard atau 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
Bagaimana mengirim alert GitHub Actions ke ponsel?
Tambahkan step nerve send dengan if: failure() dan simpan NERVE_DSN sebagai GitHub Actions secret.
Apakah sender DSN bisa membaca alert lama?
Tidak. Sender DSN hanya bisa mengirim encrypted signals ke satu pipe.
Apakah perlu menjalankan agent untuk menerima alerts?
Tidak. Agent opsional dan dipakai untuk signed actions di mesin tepercaya.