Start script after another one (already running) finishes

Solution 1:

Given the PID of the first process, the loop

while ps -p $PID; do sleep 1; done ; script2

should do the trick. This is a little more stable than pgrep and process names.

Solution 2:

Maybe you can press ctrl+z first and enter

fg; echo "first job finished"