LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2005, 10:43 PM   #1
Lion0928
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
Shell Executions


Hello, im pretty new to linux and am doing a project on building a cluster. Ive already built the cluster and have some software to test it with. However, I want to run a program X number of times at the same time so they will all begin executing and split up the number of tasks among the computers. So, my question is Does anyone know how to execute one binary that I have compiled X number of times?

What I was thinking was that it could be done like:
./testapp -someargument X

where someargument will make that progran execute X number of times begining them all at the same time.



Thanks,
Taylor

Last edited by Lion0928; 01-21-2005 at 11:01 PM.
 
Old 01-21-2005, 11:50 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Maybe a little loop? Put the command you want to run in place of where I have the ls
Code:
#!/bin/bash

# set this to the number of times you want to run
num=5

for (( i=1; i<=$num; ++i )); do
   ls &
done

Last edited by homey; 01-22-2005 at 06:43 AM.
 
Old 01-22-2005, 12:37 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
I think homey has the right idea (in fact, I think his script is only missing one character):
Code:
#!/bin/bash

# set this to the number of times you want to run
num=5

for (( i=1; i<$num; i++ )); do
   ls &
done
Without the '&' the script will launch all of the ls commands one-at-a-time. That won't tax a cluster much. Running them in the background will allow the script to shoot off each ls without waiting for it to finish.

Quote:
Originally posted by Lion0928
What I was thinking was that it could be done like:
./testapp -someargument X
Short answer: no, there's no global command-line argument to cause a process to spawn X times.

Long answer: It depends on the software. You say you compiled it. I don't know if that means you wrote it yourself, or just downloaded a tarball from a site. I'm assuming you downloaded it, because you'd probably know whether the program supports that kind of command-line argument if you wrote it

So, you'll need to check the software's documentation. That's not a fequently needed option, so I would guess you'll have to use a script like homey suggested. You'll also need to know how a job gets placed into the cluster's job pool. I don't have any experience with clusters, but I would imagine there is some sort of special command to submit a job into the cluster (as opposed to just running a command on the local machine/node you're using). Again, that should be in documentation somewhere, and you'd have to modify the script accordingly.
 
Old 01-22-2005, 06:43 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Thanks Dark_Helmet,

I also changed the loop abit.

for (( i=1; i<=$num; ++i )); do
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 07:45 PM
51 characters only in the 1st Line of command line eggCover Linux - General 2 07-29-2004 01:28 PM
program executions thru prompt kev^ Linux - General 4 03-14-2004 11:59 AM
Command to display whole filestructure hierarchy f/ command line? mjewell Linux - Newbie 10 01-19-2004 10:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration