Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Set Up a Monitoring Service with systemd

systemd can run your health check without cron: a oneshot .service plus a .timer is the clean Ubuntu pattern.

Steps

  1. Create (or reuse) a health script:

    sudo tee /usr/local/bin/vps-health.sh >/dev/null <<'EOF'#!/bin/bashecho "=== $(date -Is) $(hostname -f) ==="uptimefree -hdf -hT /EOF
    sudo chmod +x /usr/local/bin/vps-health.sh
  2. Define the oneshot service:

    sudo tee /etc/systemd/system/vps-health.service >/dev/null <<'EOF'[Unit]Description=VPS health snapshot[Service]Type=oneshotExecStart=/usr/local/bin/vps-health.shEOF
  3. Define the hourly timer and enable it:

    sudo tee /etc/systemd/system/vps-health.timer >/dev/null <<'EOF'[Unit]Description=Run VPS health hourly[Timer]OnCalendar=hourlyPersistent=true[Install]WantedBy=timers.targetEOF
    sudo systemctl daemon-reload
    sudo systemctl enable --now vps-health.timer
    systemctl list-timers | grep vps-health
  4. Run once manually and read the journal:

    sudo systemctl start vps-health.service
    sudo journalctl -u vps-health.service -n 50 --no-pager

Tips

  • Prefer timers over cron when you already live in systemd — restarts and logs stay unified.
  • You can extend the script to email on thresholds.

ext step

Stable services on your own VPS: Deploy your Cloud VPS.

Related guides