Sponsored Content
Top Forums Shell Programming and Scripting How to achieve Parellelism for the function which has multiple cp commands Post 302398845 by kgsrinivas on Thursday 25th of February 2010 07:11:34 PM
Old 02-25-2010
How to achieve Parellelism for the function which has multiple cp commands

Hi,

Here is my requirement.

Currently, there is a function which gets called in a for loop 2 times.

Code:
doCopy() {

cp  /src/a*.jar  /target/
cp /src/b*.jar /target/
cp /src/c*.jar /target

}

Since it is called sequentially from the for loop, I was asked to make parellel copy to speed up.

I've done some thing like
Code:
for i in 1, 2 do:
  doCopy &
  PIDARR[I]=&!
done
waitForAllCopiesFinish

In waitForAllCopiesFinish, I've a logic to wait till the PIDS in array are completed running and then I display "Completed"

But, my logic is not working. Whenever doCopy & is called, PID returns for some process called "bash" and there is some "cp" process parellely runs but I never see that PID returning. Not sure, how I get the PID for the "cp" process out of many "cp"s running in the system already.

Appreciate if you help me in this regard.

Thanks

Last edited by Scott; 02-25-2010 at 08:18 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

is there a way to achieve this with compress?

I'm trying to figure out how I can get an equivalent output to a text file such as if I use gunzip -l filename in that gunzip will output the previous file size and the compressed size and the ratio... is there a way to achieve this with compress and zip? i am very new at shell... (3 Replies)
Discussion started by: nortypig
3 Replies

2. UNIX for Dummies Questions & Answers

Do i need a script to achieve this?

Hi all, i have a following folder call 'zz'. This 'zz' folder is found in the following directories. I would like to delete the zz in the following directories /aa/zz /aa/bb/cc/zz /aa/bb/cc/dd/zz /aa/bb/cc/dd/ee/zz and keep the zz folder in the following directories /WW/zz ... (1 Reply)
Discussion started by: new2ss
1 Replies

3. Programming

How to achieve Serialization in Unix C, C++

How to achieve SERIALIZATION in Unix , C, C++ Write Objects directly to disk and read back ? (1 Reply)
Discussion started by: Sivaswami
1 Replies

4. Shell Programming and Scripting

How to achieve this?

hi to all, i have the input(text file) like the below... Header 1,2,3 4,5,6 7,8,9 Footer i need a output(text file) like the below... Header,1,2,3,Footer Header,4,5,6,Footer Header,7,8,9,Footer please help me to find out? (2 Replies)
Discussion started by: aaha_naga
2 Replies

5. Programming

ndd commands using function calls

Hi, Is there any function calls available ( for using in a C program ) to get the Ethernet Link status. ? I am looking for the status available from ndd /dev/hme link_status And how about plumbing and configuring an interface using C program ? BTW, Is all this documented... (3 Replies)
Discussion started by: shibz
3 Replies

6. Shell Programming and Scripting

Is there a simpler way to achieve this?

Hi all I have the following which is part of a larger interactive script for adding virtual hosts to Apache's configuration (it was built for non-technical administrators). I'm curious as to whether there is a simpler way of achieving the same thing. All it does is look into the... (3 Replies)
Discussion started by: mlott
3 Replies

7. Solaris

Help with executing multiple remote commands after multiple hops

Hi SSHers, I have embedded this below code in my shell script.. /usr/bin/ssh -t $USER@$SERVER1 /usr/bin/ssh $USER2@S$SERVER2 echo uptime:`/opt/OV/bin/snmpget -r 0 -t 60 $nodeName system.3.0 | cut -d: -f3-5` SSH to both these servers are public-key authenticated, so things run... (13 Replies)
Discussion started by: LinuxUser2008
13 Replies

8. UNIX for Advanced & Expert Users

how to achieve this output ?

in AIX ,HP Unix and in SUN solaris, how to find the logs by date and time, I mean , Logs which have been generated or updated most recently , which might be present in folders and sub folders, I need to get the list of these Logs along with location path. Example: ======== folder... (3 Replies)
Discussion started by: sidharthmellam
3 Replies

9. Shell Programming and Scripting

perform 3 awk commands to multiple files in multiple directories

Hi, I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them. Each of... (20 Replies)
Discussion started by: amarn
20 Replies

10. UNIX for Advanced & Expert Users

Pass Multiple Commands and Open Multiple Xterms via PSS

Hello, I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Discussion started by: icemanj
11 Replies
MAVEN(1)							   User Commands							  MAVEN(1)

NAME
Maven - Installs a jar into /usr/share/maven-repo. SYNOPSIS
mh_installjar [option]... [pom] [jar] [link]... DESCRIPTION
Installs the jar file in /usr/share/maven-repo, at the correct location for Maven. The jar is copied into the build directory. It can also create additional links to the jar, usually located in /usr/share/java. Where [pom] is the location of the POM associated with the jar to install. GroupId, artifactId and version will be extracted from this file. [jar] is the path to the jar to install, usually located in the build folder. [link] is an additional link to the jar to install, usually there should be a link to usr/share/java/$jar.jar and usr/share/java/$jar-$version.jar to comply with the Java packaging guidelines. Note that there is no need to specify those particular links if the --java-lib option is used. OPTIONS
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this jar file -e<version>, --set-version=<version>: set the version for the jar, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules Maven rules are used here to extract the groupId, artifactId and version from the POM file. -l --java-lib: Optional, if given it will install the jar into /usr/share/java to comply with the Debian Java specification. The jar will be installed as /usr/share/java/$name-$version.jar and a versionless link /usr/share/java/$name.jar will point to it, as well as the links installed in /usr/share/maven-repo -n<name> --usj-name=<name>: Optional, the name to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the artifact id found in the POM. -j<version> --usj-version=<version>: Optional, the version to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the version found in the POM. -s --no-usj-versionless: Optional, don't install the versionless link in /usr/share/java. This flag is used only when the -l or --java-lib option is given. -d<path> --dest-jar=<path>: Optional, the destination for the real jar. The other places where the jar appears, in the repository or in the list of links, will be symlinks to this jar. Defaults to /usr/share/java/$name-$version.jar if --java-lib is used, otherwise the jar is installed in the versioned path in the Maven reposi- tory. -c<classifier> --classifier=<classifier>: Optional, the classifier for the jar. Empty by default. -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options. mh_cleanpom is run only to extract the groupId, artifactId and version of the jar See also: mh_installpom(1), mh_installsite(1) Maven Repo Helper version 1.7.1 January 2012 MAVEN(1)
All times are GMT -4. The time now is 10:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy