Get a text before your SSL certificate expires

Yes. Homing Pigeon (homingpigeon.dev) lets a short shell script check the certificate your site serves every day and text your phone when it has less than 14 days left, so you can renew it before visitors see a warning. Your coding agent can set it up on the server you already have.

What to tell your agent

Use Homing Pigeon to text me when the SSL certificate for my site has less than 14 days left.

Your agent asks for your number, you read back the six-digit code, and it does the rest.

How it works in code

Install the command with npm install -g homingpigeondev and verify your phone. Then save this as cert-check.sh, with your own sites and limit:

#!/bin/sh
limit=14
now=$(date +%s)
day=$(date +%Y%m%d)

for host in example.com api.example.com; do
  end=$(echo | timeout 10 openssl s_client -connect "$host:443" -servername "$host" 2>/dev/null |
    openssl x509 -noout -enddate 2>/dev/null | cut -d= -f2)
  if [ -z "$end" ]; then
    homingpigeon send "Could not read the certificate for $host from $(hostname)." --idempotency-key "cert-$host-$day"
    continue
  fi
  expires=$(date -d "$end" +%s)
  left=$(( (expires - now) / 86400 ))
  if [ "$expires" -le "$now" ]; then
    homingpigeon send "The certificate for $host has expired." --idempotency-key "cert-$host-$day"
  elif [ "$left" -lt "$limit" ]; then
    homingpigeon send "The certificate for $host expires in $left days, on $(date -d "$end" +%F)." --idempotency-key "cert-$host-$day"
  fi
done

Then run it once a day from cron:

0 9 * * * PATH=/usr/local/bin:/usr/bin:/bin /home/me/cert-check.sh

Good to know

  • The text reads like "The certificate for example.com expires in 9 days, on 2026-12-01." The site and the date in the idempotency key mean each site texts you at most once a day, and you get one reminder each morning until the certificate is renewed. A quiet phone means every site has at least 14 days left.
  • The script reads the certificate the server actually sends, not the file on disk. That also catches a certificate that was renewed but never loaded, because the web server was not reloaded after renewal.
  • -servername sends the site's name during the connection, so a server that hosts several sites returns the certificate for the one you asked about.
  • If a site does not answer within 10 seconds, its name does not resolve or it sends no certificate, you get a "Could not read" text instead, so a typo in the list or a server that is down never looks like a pass. An expired certificate can still be read, so it texts you that it has expired.
  • If your certificates renew on their own, set the limit below the point where renewal normally happens, so a text means renewal has stopped working. For a service on another port, change 443 in the script.
  • The script uses date -d and timeout, which come with Linux. Verify as the same user the cron job runs as, because the key is saved in that user's home folder.
  • Messages are limited to 480 characters and go only to the US mobile number you verified. Delivery is not guaranteed, so treat each text as a heads-up.

Get started

Add Homing Pigeon to Claude Code, then ask for what you want:

claude mcp add homingpigeondev -- npx -y homingpigeondev mcp

You get 50 free texts every month, on US mobile numbers. See more use cases.