three stacks of high society


Engineer and open source software advocate living and working in Austin, Texas

python

Using Python to monitor expiring domains

Tags:

I wanted a script that would monitor our domain names and notify the proper people when the time came to renew. I came across this, but it:

  • requires modification when we add or delete domain names (which we do very often)
  • doesn't differentiate its output based on the expiration date, resulting in lots of noise

So I decided to write a Python-based script that would scan Apache's vhost directory, pull out unique domain names based on the vhost files, figures out how long until each domain expires, and then only emails you the domains that are expiring within a set number of days. This alleviates the need for someone to modify the script when a new domain is added and reduces email noise.

To use, download and modify the script to suit your needs. Make sure you change the "To" email address, days_ahead you want notified, vhost file regex, and possibly vhost_path. Then run it on cron every two weeks or so.

The output looks something like this:

From: apache
To: victor
Subject: Expiring domains

yahoo.com expires in 1401 days
cnn.com expires in 551 days

Syndicate content

Recent Flickr photos

Downtown StuttgartThe CubeFeinkost Bohm and BW|BankHäussler City PlazaVolgelsangstrasseView from BismarckstrasseMy Mom's Stuttgart PaintingBefore the moversBefore the movers

Recent comments

I Approve Of

Random Flickr photos

IMG_6057.JPG0150.jpgMunichEmilycannstatter volksfest 20070318.jpg

Blame me for

ClemsonTALK - Clemson's largest forum
Clemson Wiki Project - Clemson oriented Wiki