Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; # # Set this script up as a cron job to have notification email sent whe +n a # domain is expiring. See the expires.lst file for the list of domains +. # NOTE: .edu domains are NOT supported at this time. # # You can also run it at the command line with the -v flag to see a li +st of # all domains and the expiration dates. # # Set the filename for the list of domains to be checked my $file = "expire.lst"; use Net::Domain::ExpireDate; use Time::Piece; use Time::Seconds; use Getopt::Std; use vars '%opts', '@expiration_list', ; getopts('v', \%opts); # Expand tilde $file =~ s{ ^ ~ ( [^/]* ) } { $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($>))[7] ) }ex; open (FILE, "<$file") or die "Unable to open $file: $!"; my @domains = <FILE>; close FILE; my $today = localtime; foreach my $line (@domains) { chomp $line; next unless defined $line && $line && $line !~ /^#/; my ($domain, @days) = split(/ /, $line); my $date = expire_date($domain); my $expire_secs = $date - $today; my $expire_days = sprintf("%d", $expire_secs->days); print "---------------\nDomain = $domain\nExpiration = " . $date->st +rftime('%Y-%m-%d') . "\nExpires (days) = $expire_days\n" if $opts{'v' +}; LINE: foreach my $look_ahead (@days) { if ($expire_days == $look_ahead) { push @expiration_list, "$domain $expire_days"; last LINE; } } } # Now print the list of expiring domains print "\n\n=======================\n" if $opts{'v'}; foreach my $line (@expiration_list) { my ($domain, $expire_days) = split(/ /, $line); print "Domain '$domain' is expiring in $expire_days days.\n"; }
The input file:
# This is the data file for the expire.pl script. The domain name shou +ld # exclude www or other subdomain values. A reminder email will be sent + on each # of the days following the domain name. # Format of this file: # <domain name> <reminder days> perlmonks.org 30 15 7 mywebsite.com 45 30 15 7

In reply to Domain Name Expiration Reminder by knowmad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (None)
    As of 2024-04-25 00:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found