I have an index.php script that I use as a post-commit URL on a Google Code site. This script clones a directory and builds a project that may take some work.
how long does it take to run.
could use memcache
get( 'job_running' ) ) exit;
else $m->set( 'job_running', true );
//index code here
//at the end of the script
$m->delete( 'job_running' );
?>
If the task fails you will need to clear from memcache. Flock is a good option too... probably better actually.