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

Random Flickr photos

0573.jpgIMG_7742.JPG0123.jpg0265.jpg0602.jpgIMG_0718 - Hydra - Returning fishing boat

Blame me for

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