script to wait for pid and notify when it's done