Hi all,
I am writing a C shell script that starts a program. The program forks of several child processes. Only when all child processes are done, I want to archive my log files. Below is what I have so far, but unfortunately it doesn't work.
MyProgram
if (-e processes.txt) then
rm processes.txt
endif
ps -C MyProgram | grep MyProgram > processes.txt
while (-s processes.txt)
rm processes.txt
ps -C MyProgram | grep MyProgram > processes.txt
rm processes.txt
# start archiving log files
The while loop is done twice and than the archiving starts, while one of the child processes is still running. Does anyone know what I am doing wrong or does anyone have any other suggestion on how to do this?
Thanks a lot.