public
Last active

A CRON job that emails me a list of domains set to expire the next day

  • Download Gist
getExpiringDomains.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php
$tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("Y"));
 
$tomorrow_egrep = date('n/j/Y', $tomorrow); # like "10/19/2012" without quotes
 
$shellCommands= <<<END
rm ~/temp/PoolDeletingDomainsList.zip ~/temp/PoolDeletingDomainsList.txt ~/temp/email_tmp.txt ~/temp/tomorrow.txt;
wget http://www.pool.com/Downloads/PoolDeletingDomainsList.zip -O ~/temp/PoolDeletingDomainsList.zip -q;
unzip -o ~/temp/PoolDeletingDomainsList.zip -d ~/temp/;
egrep -e "{$tomorrow_egrep}" ~/temp/PoolDeletingDomainsList.txt > ~/temp/tomorrow.txt;
egrep "^[a-z]{2,7}bot.com," ~/temp/tomorrow.txt > ~/temp/email_tmp.txt;
echo "-----" >> ~/temp/email_tmp.txt;
egrep "^[a-z]{2,7}.com," ~/temp/tomorrow.txt >> ~/temp/email_tmp.txt;
cut -d, -f1 ~/temp/email_tmp.txt > ~/temp/email.txt;
cat ~/temp/email.txt | sed 's/\\n/ /g' | mail -s "Expiring domains" youremail@example.org
END;
shell_exec($shellCommands);
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.