Created
November 16, 2013 02:38
-
-
Save vmirly/7495201 to your computer and use it in GitHub Desktop.
Run a new job after an already running job finishes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # assume that job1.sh is already running | |
| # we want to start jab2.sh right after job1.sh finishes | |
| pid=$(ps -o pid= -C job1.sh) | |
| while [ -d /proc/$pid ]; do | |
| echo "process $pid still running" | |
| sleep 60 | |
| done && ./job2.sh |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for ps. -o is an output specifier, which here it tells ps that we only want the pid
and -C specifies the command