Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gav (2710)

  (email not shown publicly)
AOL IM: flufflegavin (Add Buddy, Send Message)

Hacker in NYC.

Journal of gav (2710)

Sunday February 01, 2004
03:18 PM

Getting domain expiry dates

[ #17140 ]

This little script will send you an email with the expiry dates for a list of domains. It's a nice thing to run as a cronjob once a month or so.

#!/usr/bin/perl -w
use Net::Domain::ExpireDate;
use Time::Piece;
use Mail::Sendmail;
use Getopt::Long;
GetOptions(debug => \my $debug);
my %domain;
while (<DATA>) {
    my $date = expire_date($_) or die "Can't get expiry date for '$_'";
    $debug and printf "%s expires on %s\n", $_, $date;
    $domain{$date->epoch} = $_;
my $msg = "Expiry dates for all hosted domains\n\n";
foreach my $date (sort { $a <=> $b } keys %domain) {
    $msg .= sprintf "%s: %s\n",
        Time::Piece->new($date)->strftime("%d %b %Y"), $domain{$date};
    To      => '',
    From    => '',
    Subject => 'Domain expiry report',
    Message => $msg
) or die "Unable to send mail: $Mail::Sendmail::error";
# domains go here, one per line

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.