← Blog  ·  October 2026

How to Monitor Domain Expiry and Get Alerts Before It Expires

Three methods to make sure you never lose a domain — from a simple cron script to automated monitoring.

Losing a domain because it silently expired is one of the most avoidable disasters in web infrastructure. Your site goes dark, your email stops working, and in the worst case a squatter registers it before you can renew. It happens more often than you'd expect — especially when auto-renew fails silently, when domains are managed across multiple registrars, or when the original billing email no longer works.

This guide covers three ways to monitor domain expiry and get alerted before it's too late.

⚠️ Why registrar reminders aren't enough Registrar reminder emails land in inboxes that may belong to former employees, go to spam, or get ignored because they arrive 60 days out and feel non-urgent. By the time the final reminder fires, you have days to act — not weeks.

Quick comparison

MethodSetup timeMaintenanceBest for
WHOIS cron script20 minLowLinux servers, technical teams
Registrar auto-renew + calendar5 minNonePersonal sites, single registrar
Dedicated monitoring service2 minNoneMultiple domains, always-on alerting

Method 1: WHOIS cron script

⚙️ Build it yourself

Setup: ~20 minutes Medium complexity Requires: Linux server, mail setup

The most direct approach: query WHOIS data for your domain and parse the expiry date. When days remaining drops below a threshold, send an alert.

First, install whois if it's not already available:

sudo apt-get install -y whois   # Debian/Ubuntu
sudo yum install -y whois       # CentOS/RHEL

Create the monitoring script at /usr/local/bin/check-domain-expiry.sh:

#!/bin/bash
# Domain expiry checker — alerts when expiry is within N days

DOMAIN="$1"
ALERT_DAYS="${2:-30}"        # Alert if expiry is within 30 days
ALERT_EMAIL="ops@example.com"

if [ -z "$DOMAIN" ]; then
  echo "Usage: $0 <domain> [days-before-alert]"
  exit 1
fi

# Query WHOIS and extract expiry date
EXPIRY_RAW=$(whois "$DOMAIN" 2>/dev/null | grep -iE "expir(y|ation).*date|paid-till" | head -1)
EXPIRY_DATE=$(echo "$EXPIRY_RAW" | grep -oE "[0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{2}/[0-9]{2}/[0-9]{4}" | head -1)

if [ -z "$EXPIRY_DATE" ]; then
  echo "ERROR: Could not parse expiry date for $DOMAIN"
  echo "WHOIS output: $EXPIRY_RAW"
  exit 1
fi

# Convert to epoch (normalize date format)
EXPIRY_EPOCH=$(date -d "$EXPIRY_DATE" +%s 2>/dev/null || date -j -f "%Y-%m-%d" "$EXPIRY_DATE" +%s)
NOW_EPOCH=$(date +%s)
DAYS_LEFT=$(( (EXPIRY_EPOCH - NOW_EPOCH) / 86400 ))

echo "Domain: $DOMAIN | Expires: $EXPIRY_DATE | Days left: $DAYS_LEFT"

if [ "$DAYS_LEFT" -le "$ALERT_DAYS" ]; then
  echo "ALERT: $DOMAIN expires in $DAYS_LEFT days ($EXPIRY_DATE)" | \
    mail -s "⚠️ Domain expiry warning: $DOMAIN" "$ALERT_EMAIL"
  echo "Alert sent to $ALERT_EMAIL"
fi

Make it executable and test it:

chmod +x /usr/local/bin/check-domain-expiry.sh
/usr/local/bin/check-domain-expiry.sh github.com 365

Add a cron job to run daily for each domain you manage:

# Check domain expiry daily at 9am
0 9 * * * /usr/local/bin/check-domain-expiry.sh yourdomain.com 30
0 9 * * * /usr/local/bin/check-domain-expiry.sh yourdomain.io 30

WHOIS limitations to know

Using RDAP instead of WHOIS

RDAP (Registration Data Access Protocol) is the modern replacement for WHOIS. It returns structured JSON, which is far easier to parse reliably:

curl -s "https://rdap.org/domain/github.com" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
events = data.get('events', [])
for e in events:
    if e.get('eventAction') == 'expiration':
        print('Expires:', e.get('eventDate', 'unknown'))
"

Method 2: Registrar auto-renew + calendar reminders

📅 Manual safety net

Setup: ~5 minutes Easy Requires: Registrar access, calendar app

For personal sites and small portfolios, a belt-and-suspenders approach with auto-renew and explicit calendar reminders works well — as long as you actually do it.

The steps:

  1. Enable auto-renew on every domain. This is the most important thing. Log into your registrar, find each domain, and confirm auto-renew is on.
  2. Verify the payment method is current. Auto-renew fails silently when the card on file has expired. Check the billing details now.
  3. Set a calendar reminder 60 days before expiry. The reminder should say "check auto-renew payment method for [domain]" — not "renew domain." This gives you enough runway to fix a failed payment before the domain actually expires.
  4. Keep a spreadsheet of all domains with their registrars, expiry dates, and renewal contact email. This sounds trivial but most outages happen because nobody knows who manages a given domain.
🔁 Auto-renew is not a monitoring strategy Auto-renew fails when cards expire, when accounts get locked, when billing emails are wrong, or when the registrar has an internal issue. It reduces risk but doesn't eliminate it. You need independent verification.

Method 3: Dedicated domain expiry monitoring

🔔 Always-on alerting

Setup: 2 minutes Easy No server required

A dedicated monitoring service checks your domains regularly and emails you before they expire — from outside your infrastructure, so it works even if your own servers are down.

The key advantage of an external service over a cron script on your server: it doesn't share failure modes with your infrastructure. If the server running your cron script has a disk failure or gets rebooted, the domain monitoring stops silently. An external service continues watching regardless.

What good domain expiry monitoring looks like:


Checklist: what to monitor beyond domain expiry

While you're setting up domain expiry monitoring, it's worth thinking about the other expiry signals that cause silent outages:

What expiresTypical failure modeAlert threshold
Domain nameSite goes down, email stops, squatting risk30 days
SSL certificate"Not secure" warning in browsers, HTTPS broken30 days
API keys / tokensSilent 401s in production30 days
TLS client certsService-to-service auth failures30 days
Code signing certsApp distribution failures, rejected builds60 days

SSL certificate expiry is the most common silent failure we see — and unlike domain expiry, it doesn't get email reminders from registrars. Certificates issued by Let's Encrypt auto-renew (when certbot is running), but certificates from other CAs don't, and Let's Encrypt auto-renewal fails silently when the certbot cron job stops working.


Which method should you use?

Use a cron script if you already have reliable server infrastructure and want zero external dependencies. Budget 20–30 minutes to write it correctly with proper error handling and email delivery.

Use registrar auto-renew + calendar reminders if you manage fewer than five domains and they all live at the same registrar. It's not automated monitoring, but it's a workable safety net if you actually follow through on the calendar reminders.

Use a dedicated monitoring service if you manage multiple domains across different registrars, if you want external verification that works even when your infrastructure has problems, or if you want SSL certificate monitoring bundled with domain monitoring in the same dashboard.

🔔 Monitor your SSL certificates too

Domain expiry and SSL certificate expiry are the two most common silent failures that take sites offline without warning. If you're setting up domain monitoring, SSL monitoring is the natural next step — and it doesn't require registrar access.

Enter any domain to check its SSL certificate expiry instantly:

Check SSL expiry free → Get SSL expiry alerts →