#!/bin/bash
until ps aux | grep -v grep | grep -v "waitfor" | grep "$1" > /dev/null
do
  sleep 0.1
done