sanitize grep call and threshold number of runningInstance