Cron / VPS

Cron job failed veya VPS down? Telefona alert gönderin.

Backup, SSL, disk space ve health check uyarıları token veya history açığa çıkarmadan gelmeli.

Short answer

Job’u çalıştıran, stderr yakalayan ve failure durumunda nerve send ile kısa özet gönderen bir shell wrapper kullanın.

Telefona full log göndermeyin. Job name, host, exit code, timestamp ve dashboard veya runbook linki yeterli olur.

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

Send-only secretSender DSN tek bir pipe içine encrypted signals gönderebilir. History okuyamaz, mesaj decrypt edemez, command çalıştıramaz.
No agent tokenNormal alerts için agent token gerekmez. Agent sadece güvendiğiniz makinede signed bounded actions için kullanılır.
Safe summarySend host, job name, exit code, and a short tail. Keep credentials out of alerts.

FAQ

GitHub Actions alert telefona nasıl gider?

Workflow’a if: failure() ile nerve send step ekleyin ve NERVE_DSN değerini GitHub Actions secret olarak saklayın.

Sender DSN eski alertleri okuyabilir mi?

Hayır. Sender DSN sadece tek pipe içine encrypted signal gönderebilir.

Alert almak için agent çalıştırmak gerekir mi?

Hayır. Agent opsiyoneldir ve trusted machine üzerinde signed actions içindir.

Related