In a korn shell script, I am running expdp. I have made the script to where it can be reusable so if a later process fails, I can run it again without running the already completed steps. I am running two processes in the background and waiting for both to complete before moving ahead in the script. For example, I am using the below logic to wait. After the expdp process completes, I am using a log function to write a completed message.
while ps | grep "expdp" | grep -v grep
do
echo expdp is still in the ps output. Must still be running.
sleep 5
done
WriteLog "Completed exporting client schemas"
If the process does not exists (i.e. reusing the script after fixing any errors which occurred after expdp), how do I set it up to where the writelog occurs only when the expdp process exists. If no process is found from ps then it should not write log again.
ps | grep expdp | grep -v grep
usage: unix.stackexchange.com/questions/3340/… There's a race condition in that pipeline that will sometimes cause it to act as if expdp process is not running. It's an ugly, ugly race, and it doesn't occur very often. Usually after working hours.