How to achieve Synchronization operation between two shells.

Hi all,

I have a master shell which will be running in cron tab.It will pick the files from certain directory and call subshell (Child Shell).This subshell / Child Shell runs in the background.

My problem is once if the master shell picks the file and passes it to subshell,it should go to some wait state.
The subshell should do some initial processing on the file and it should pass signal so the master shell should continue its work.

Is there any way of built-in implementation of this semaphores in HP-UX.?

Please guide me any suitable way to accomplish the given task.

Check the wait command for the shell that you are using to write the script. You can wait in a shell script just as you can wait(2) in C.

You will have to modify the sub shell to create sephamore file in to let you know that the part of the process you wanted to be completed in the sub shell is done.

For eg. in the sub_shell.sh

statement 1
statement 2
statement 3
#suppose you want the parent shell to know that it has reached this state in the process
# Create the file

echo "PASSED" > passed.sep
statement 4
statement 5

Then in your parent shell

sub_shell.sh input_file.txt

while [ ! -s passed.sep ]
do
sleep 30

done

rm -f passed.sep

#######################

The sleep command takes seconds as input.

Let me know if it works!!!

how to achieved synchronisation in unix threads

how unix threads achieved synchronisation?

/////////

No Hyacking, bumping and double posting!

The rules are for all of us..., read them again:
The UNIX and Linux Forums - Forum Rules