---
title: "Heartbeat Monitoring (Cron)"
description: "Heartbeat monitoring (also known as Cron Monitoring) works in reverse: instead of us checking your server, your server (or script) notifies us that it is alive."
---

This is perfect for monitoring:

- **Daily Backups:** Ensure your database backups actually ran.
- **Background Jobs:** Monitor workers, import scripts, or periodic tasks.
- **Intranet Devices:** Monitor devices behind a firewall that can send outbound requests.

## How it works

1. You create a **Heartbeat Monitor** in the dashboard.
2. We give you a unique **Heartbeat URL**.
3. You configure your script (Cronjob, Worker) to call this URL when it finishes successfully.
4. We expect a ping within your configured **Interval** (plus a **Grace Period**).
5. If we don't receive a ping in time, we send an alert: "Heartbeat missing".

## Configuration

### Expected Interval
How often do you expect the ping?

- *Example:* For a daily backup, set this to **24 hours** (1440 minutes).
- *Example:* For a minutely worker, set this to **1 minute**.

### Grace Period
How much delay is acceptable?

- *Example:* If your backup usually takes 10 minutes but sometimes 30, set the Grace Period to **30 minutes**.
- We will only alert if `Last Ping Time + Interval + Grace Period < NOW`.

## Usage Examples

### Linux Cronjob (Backup Script)

```bash
#!/bin/bash
# Run backup ...
pg_dump dbname > backup.sql

# If successful, ping the heartbeat
if [ $? -eq 0 ]; then
  curl -m 10 --retry 3 https://ping.uptimeify.io/ping/YOUR_TOKEN
fi
```

### PowerShell (Windows)

```powershell
# Run task...
Write-Output "Task running..."

# Ping Heartbeat
Invoke-RestMethod -Uri "https://ping.uptimeify.io/ping/YOUR_TOKEN"
```

### Node.js Worker

```javascript
await doImport();

// Ping
await fetch('https://ping.uptimeify.io/ping/YOUR_TOKEN');
```

