Illusory Follies Andrew Flanagan's Blog

5Apr/101

Project Idea #35: Auto Tasks via Email

Create a program that is designed to parse and track projects and tasks from emails alone. The point would be to make it completely non-intrusive (albeit not entirely non-interactive). So for example, when composing a message to a client or customer you might be asking a question. You want a response (there's a "task" outstanding that's pending a decision or some action). You would simply BCC the special mailbox. The message would be parsed and tracked. When the user replies, the same program is monitoring your incoming mailbox items. When the message arrives it would attempt to interpret whether the task was complete or not. It could then fire a simple email to you indicating that it THINKS that the task is complete with a simple Yes/No form that would let you close the task or not and also possibly make notes or record anything of interest. Or alternatively you could manually complete tasks by forwarding the message to the same mailbox.

This probably is not incredibly value in its proposed form -- I'm sure something similar exists. But it would be fun to work on and would be neat to see how smart you could train it to be. Introduction of learning algorithms that would adapt to particular users would be even better.

10May/080

Forever Updating

I find little time these days and I noticed with some annoyance that I was behind with my WordPress updates. I run a number of sites (13 WordPress sites alone) and updating from 2.5 -> 2.5.1 is sort of painful and tedious.

So I made a script (most of the domain names are removed but you could add to the list):

sites=(illusoryfollies.com
       flanaganclan.com
       sarahflanagan.com)
 
base_path="/var/www/vhosts"
wordpress_download_url="http://wordpress.org/latest.tar.gz"
wordpress_download_file="latest.tar.gz"
wordpress_download_directory="wordpress"
wordpress_database_update_url="wp-admin/upgrade.php?step=1&backto=%2Fwp-admin%2F"
jailed_directory="httpdocs"
temp_directory="wp-temp"
 
number_of_sites=${#sites[@]}
 
 
echo "Updating $number_of_sites websites with the latest version of Wordpress."
 
for current_site in ${sites[@]}
do
  echo "Now processing $current_site..."
  echo "  Setting up directories..."
  if [ -e $base_path/$current_site/$jailed_directory ]
  then
    echo "  !!Detected a jail'ed website..."
    mkdir -p $base_path/$current_site/$jailed_directory/$temp_directory
    cd $base_path/$current_site/$jailed_directory/$temp_directory
  else
    mkdir -p $base_path/$current_site/$temp_directory
    cd $base_path/$current_site/$temp_directory
  fi
 
  echo "  Downloading latest version of Wordpress..."
  wget -q $wordpress_download_url
  echo "  Uncompressing..."
  tar zxfv $wordpress_download_file > /dev/null
  cd $wordpress_download_directory
  echo "  Copying into existing directory..."
  cp -r * ../..
  cd ../..
  echo "  Updating database..."
  wget -q "http://$current_site/$wordpress_database_update_url" -O /dev/null
  echo "  Cleaning up..."
  rm -rf $temp_directory
  echo "Done processing $current_site."
  echo ""
 
done

Now it takes about 15 seconds to update everyone's site and it even performs the "Database Upgrade" step (at least for now).

Automation is a good thing. Speaking of which, I'm interested in Capistrano but I still haven't really done anything with it. It looks like fun... I'll have to add a post if I have any luck experimenting with it.