36 Child Processes not running as desired

I have a parent process which will start 36 child process. This I achieved by using the 'for loop'.

In Parent.sh:-
./Child.sh <arg1> <arg2> ... &

If I execute "ps -ef | grep Child.sh", I can see 72 child processes running at the background. I mean I can see the duplicate of each process.

Few Outputs:-
root 21239 15095 0 09:40:09 pts/1 0:00 /bin/bash ./Child.sh /TS_Files/abcdCCR1/ abcdccr1 abcdCCR1
root 15095 1 0 09:38:51 pts/1 0:00 /bin/bash ./Child.sh /TS_Files/abcdCCR1/ abcdccr1 abcdCCR1

Moreover the child processes are not working as desired. That is, Child process receives the arguments which sends from Parent. But the child process not at all using this arguments for its processing.

If I invoke only two child processes, I can see the desired results. In two child process scenario, if I execute the ps -ef command as mentioned above, there are no duplicate process created. Only when I invoke more child processes, I have the problem as mentioned above.

I am suspecting, Does the duplicate process creates any problem in my case?

Can anyone help me on this regard?

Thanks
Thiru

Can you please post the exact code you have ?

root@Sam104 # cat Parent.sh 
#!/bin/bash
INDEX=0
INDEX1=1
INDEX2=2
for line in `cat NODES.txt`;
do
        array[$INDEX]=$(pwd)"/"$line"/"
        array[$INDEX1]=$(echo $line | tr "[:upper:]" "[:lower:]") 
        array[$INDEX2]=$line
        mkdir "${array[$INDEX2]}"
        echo "admin tech-support ftp://root:5620Sam!@172.16.10.10"$(pwd)"/"${array[$INDEX2]}"/"${array[$INDEX1]} > $(pwd)"/"${array[$INDEX2]}"/"Script
        ./Child.sh ${array[$INDEX]} ${array[$INDEX1]} ${array[$INDEX2]} &
        INDEX=`expr $INDEX + 3`
        INDEX1=`expr $INDEX1 + 3`
        INDEX2=`expr $INDEX2 + 3`
done
root@Sam104 # 




root@Sam104 # cat Child.sh 
#!/bin/bash
i=1
j=1
while [ $i = 1 ]
do
        file_exist=$(ls -l $1 | grep $2)
        length=${#file_exist}
        size=$(ls -l $1 | grep $2 | awk '{ print $5 }')
        echo "$1    $2    $length    NE's CRON scheduler: Not yet started"
        if [ $length != 0 ]
        then
                new_file_name=`date +%d%m%y%H%M%S`
                echo "NE's CRON scheduler: Started"
                echo "Dumping the TS File . . ."
                k=1
                while [ $k != 2000 ]
                do
                        present_size=$(ls -l $1 | grep $2 | awk '{ print $5 }')                 
                        if [ $size = $present_size ]
                        then
                                k=`expr $k + 1`
                        else
                                j=`expr $j + 1`
                                size=$present_size
                        fi
                done    
                j=1
                cpy_status=$(cp $1$2 $1$3"_"$new_file_name)
                delete_status=$(rm $1$2)
                echo "File Details:- File Name: $3"_"$new_file_name File Size: $present_size"
                sleep 5
        fi
done

root@Sam104 #