Created
November 7, 2017 20:01
-
-
Save hardboiled/bcc532af2acf6714b94e82e55bc8a1f5 to your computer and use it in GitHub Desktop.
This file contains 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
#/bin/bash | |
# usage: $PID=<process_id_to_wait_on> $SCRIPT=<script_to_run_after_process_exits> sh ./run-script-on-process-complete.sh | |
STR="$(ps -opid | grep $PID | grep -v grep)" | |
echo $STR | |
while [ "$STR" = "$PID" ]; do | |
sleep 1; | |
STR=`ps -opid | grep $PID | grep -v grep` | |
done | |
sh $SCRIPT 2 > errors.log > output.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment