Created
October 18, 2012 20:14
-
-
Save runion/3914495 to your computer and use it in GitHub Desktop.
A CRON job that emails me a list of domains set to expire the next day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment