systemd puede ejecutar tu chequeo de salud sin cron: un .service oneshot más un .timer es el patrón limpio en Ubuntu.
Pasos
Crea (o reutiliza) un script de chequeo:
sudo tee /usr/local/bin/vps-health.sh >/dev/null <<'EOF'#!/bin/bashecho "=== $(date -Is) $(hostname -f) ==="uptimefree -hdf -hT /EOFsudo chmod +x /usr/local/bin/vps-health.shDefine el servicio oneshot:
sudo tee /etc/systemd/system/vps-health.service >/dev/null <<'EOF'[Unit]Description=VPS health snapshot[Service]Type=oneshotExecStart=/usr/local/bin/vps-health.shEOFDefine el timer (cada hora) y actívalo:
sudo tee /etc/systemd/system/vps-health.timer >/dev/null <<'EOF'[Unit]Description=Run VPS health hourly[Timer]OnCalendar=hourlyPersistent=true[Install]WantedBy=timers.targetEOFsudo systemctl daemon-reloadsudo systemctl enable --now vps-health.timersystemctl list-timers | grep vps-healthLanza una pasada manual y mira el journal:
sudo systemctl start vps-health.servicesudo journalctl -u vps-health.service -n 50 --no-pager
Consejos
- Prefiere timers a cron cuando ya vives en systemd: reinicios y logs quedan unificados.
- Puedes encadenar el script con envío de email si cruzas umbrales.
Siguiente paso
Servicios estables en un VPS propio: Despliega tu VPS Cloud.