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.
Only if you save the state of the running script and check when the script starts if an other script is currently active.
For example to save if a script is running you could do something like this:
$state = file_get_contents('state.txt');
if (!$state) {
file_put_contents('state.txt', 'RUNNING, started at '.time());
// Do your stuff here...
// When your stuff is finished, empty file
file_put_contents('state.txt', '');
}