Run a command every n seconds on input coming from standard in.