run and stop a service with a time limit