LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-31-2012, 12:31 AM   #1
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Rep: Reputation: Disabled
How to run multiple process


hello friends,
i want to run/start multiple process in single command line. please do reply if anybody have an idea. ex: abc1 abc2 abc3 are three process which i want to run. instead of typing separate ./abc1 ./abc2 ./abc3 in three separate command line i want to run it in single command line. Do reply plz Thanku
 
Old 01-31-2012, 12:39 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,254

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
What have you tried so far?
Lookup the 'nohup' cmd, along with backgrounding a process using the '&' char
See these links
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
Old 01-31-2012, 12:57 AM   #3
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
Wink

oh yes sir.. means at a time we can give al process in single command line .since i m new to linux i was not knowing this. previously i was executing each process separately. big headache over otherwise every time 20 25 processes i was starting separately. thank u
 
Old 01-31-2012, 01:33 AM   #4
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
You can execute multiple commands on a single line like this:

Quote:
# command1 ; command2
Will execute both commands, whatever append after the first one.

If you want to execute 1 command, than execute a second one only if the first one succeed, you have to use this:
Quote:
command1 && command2
The && is the binary AND operator. When you use it with commands, the line is evaluate as a Boolean expression. To be TRUE (succeed), the expression must have both parts TRUE. If the first one is FALSE (the command fail), the system do not need to evaluate the second one since "FALSE && whatever" is always FALSE.

Note: You can use this with multiple commands
command1 && command2 && command3 && command4
You can also mix it with the OR operator (two pipes ||), but it make code very difficult to understand. If you want to execute something more complex, use the if statement.

And also check this page for more information:

http://www.skorks.com/2010/05/execut...ductivity-tip/

Last edited by Satyaveer Arya; 01-31-2012 at 01:42 AM.
 
Old 01-31-2012, 01:53 AM   #5
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by Shahid nx View Post
hello friends,
i want to run/start multiple process in single command line. please do reply if anybody have an idea. ex: abc1 abc2 abc3 are three process which i want to run. instead of typing separate ./abc1 ./abc2 ./abc3 in three separate command line i want to run it in single command line. Do reply plz Thanku
I guess you are asking about executing 3 scripts abc1, abc2, abc3 in a single command?

you can add the names in a single script and execute it

Code:
#vi /abc.sh
#!/bin/bash
./abc1.sh &&
./abc2.sh &&
./abc3.sh &&
wait
echo "Finished"
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Why a Process shows multiple process ids(pids) ? thelink123 Linux - Newbie 1 11-10-2010 01:18 AM
Multiple postgres process arunkeerthan Linux - Server 0 08-02-2010 06:30 AM
How to run the linux process on multiple core saurin Linux - General 1 10-26-2009 03:01 PM
How to run multiple process in single command prompt babu198649 Linux - Newbie 7 10-12-2007 09:27 AM
A lot of processes run automatically when I run a single process. dalvirgautam Linux - Enterprise 4 12-01-2006 07:10 PM


All times are GMT -5. The time now is 01:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration