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 domainsyahoo.com expires in 1401 days
cnn.com expires in 551 days
| Attachment | Size |
|---|---|
| check_domain_expiration.py.txt | 1.82 KB |



















Post new comment