This is the best web way to avoid two processes running at the same time.  Similar logic could be put into the command.