script to wait for an already started process to end