Skip to content

Instantly share code, notes, and snippets.

@runion
Created October 18, 2012 20:14
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runion/3914495 to your computer and use it in GitHub Desktop.
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
<?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