# command to run # php migrate.php --old-database heinessenmlp --board mlp --phase 1 # String that we get if command fails (this is just part of it, but should be enough to do the search) # "[database error] Deadlock found" # output of command needs to be recorded and when it's done checked for this string # If it exits without a deadlock message then it's probably finished command output = (php migrate.php --old-database heinessenmlp --board mlp --phase 1) while "[database error] Deadlock found" in command_output: ?# I am assuming that the command will finish and that the output from the most recent run will overwrite the old run's output ?command output = (php migrate.php --old-database heinessenmlp --board mlp --phase 1) print "Merge done."