Executing multiple kshs from parent ksh

Hi,

I have to migrate files from one server to another .For this I am using a mapping file and ksh .The mapping file contains the source and destination directories of the files to be migrated.Each line in the mapping file corresponds to one file that is to be migrated.The ksh upon execution performs the task of connecting to the source server and migrates them to the destnation server.

But the problem is:there are some 20000 files to be migrated and the ksh can process 4000 files in 6 hours.I am thinking of running multiple instances of the ksh from a parent ksh which can run independent of each other,so that parallel processing can be done.
If my parent ksh is parent.ksh and migration ksh is migrate.ksh, how can invoke multiple instances of migrate.ksh from parent.ksh for parallel exec .The migrate.ksh takes the input parameters as from_line and to_line from the mapping file.If in the parent.ksh I write
./migrate.ksh 1 4000
./migrate.ksh 4001 8000
....
Will parallel execution take place?
If not then suggest me a way how this can be done(pls provide code snippet)?

Regards,
Kishore

Hi,

You can use:

./migrate.ksh 1 4000 &
./migrate.ksh 4001 8000 &
wait

Hi,

Will this code do parallel execution,I mean will
./migrate.ksh 1 4000 and ./migrate.ksh 4001 8000 will run simultaneously,without any dependency?

yes..

as & will make comamnd to run in back ground ... so control will come to next line .. before the earlier one is finished .. and wait at the end will make parent script to wait for all child processes

-----------
wait [n]
Wait for the specified process and return its termination sta-
tus. n may be a process ID or a job specification; if a job
spec is given, all processes in that job's pipeline are waited
for. If n is not given, all currently active child processes
are waited for, and the return status is zero. If n specifies a
non-existent process or job, the return status is 127. Other-
wise, the return status is the exit status of the last process
or job waited for.
-----------