Run some command repeatedly and check output.