Do you want to run a Linux or Unix/macOS program directly after some other process has ended? Use the pwait as follows:
```pwait pid && new_app1```
For example, for demo run sleep for 1200 and wait to end and then run the app2:
```sleep 1200 &
pwait pid_of_sleep_here && app2```
See the `pwait` man page for more info as syntax changes slightly between Linux and BSD version. This is very handy utility and not well known to many:
`man pwait`