Running multiple processes in Linux


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Running multiple processes in Linux
# 1  
Old 07-09-2007
Bug Running multiple processes in Linux

Hi guys,

I want to run the multiple scripts at the same time using a ksh script.

For example, I have three scripts to run:
a.ksh, b.ksh and c.ksh

How to start the above 3 scripts simultaneously and then on the completion of the above scripts I have other tasks to schedule.

Thanks
Gary
# 2  
Old 07-09-2007
Code:
a.ksh &
b.ksh &
c.ksh &
wait

This will work as long as the scripts do not write to the terminal.
# 3  
Old 07-09-2007
Quote:
Originally Posted by jim mcnamara
Code:
a.ksh &
b.ksh &
c.ksh &
wait

This will work as long as the scripts do not write to the terminal.
I would argue that it will work as long as they all don't want to read from terminal. Smilie
# 4  
Old 03-24-2009
Hi,

I am doing a "rsync" to another machine and the arguments that i pass is shown below.

1. $HOME/Robin.ksh us
2. $HOME/Robin.ksh uk
3. $HOME/Robin.ksh in

How can i run all the three at the same time. Cant use "&" in this case.

Basically need to execute this at different shells.
Need to sync everything at the same time.


Regards,
Robin
# 5  
Old 03-24-2009
Why not?
Code:
pl@desktop:~/testbed> cat test1.sh
#!/usr/bin/ksh
sleep 10
echo $1
pl@desktop:~/testbed> ./test1.sh ab
ab
pl@desktop:~/testbed> ./test1.sh cd
cd
pl@desktop:~/testbed> ./test1.sh ef
ef
pl@desktop:~/testbed> cat test2.sh
#!/usr/bin/ksh
./test1.sh ab &
./test1.sh cd &
./test1.sh ef &
wait
echo "All done"
pl@desktop:~/testbed> ./test2.sh
ab
ef
cd
All done
pl@desktop:~/testbed>

# 6  
Old 03-24-2009
Thanks for you answer bro.

but
Can we give it with out SLEEP?
starting everything at the same time?
# 7  
Old 03-24-2009
Of course. The sleep was in there for demonstration purpose only, since such a short script would finish before the next would be started. In order to demonstrate parallel execution properly, I had to delay them a bit.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multi threading - running multiple processes at the same time

so i've been using this a lot in a lot of my scripts: ( columnA & columnAPID=$! & columnB & columnBPID=$! & columnC & columnCPID=$! &) & wait ${columnAPID} wait ${columnBPID} wait ${columnCPID} It seems to work as ive seen it dramatically reduce run time of my scripts. however, i'm... (5 Replies)
Discussion started by: SkySmart
5 Replies

2. Linux

Running processes

Hi guys is it normal to have 5-10 cron/syslog processes running... in my case i got 10 cron process running. (4 Replies)
Discussion started by: batas
4 Replies

3. Shell Programming and Scripting

Logging in to multiple Linux servers and running the command.

Hi, I am trying to write a script to run a command on multiple linux based servers and get the o/p. I am using ssh to login. It is a celerra box and EMC NAS product. I am able login but i am not able to run nas command nas_pool -size -all the NAS server. I am getting the following error. ... (2 Replies)
Discussion started by: jpkumar10
2 Replies

4. Solaris

Running processes on GZ/LZ

Hi guys just a question is it normal to see running process on a non-global zone in the global zone... processes such as cron. (3 Replies)
Discussion started by: batas
3 Replies

5. Shell Programming and Scripting

how to know the running processes.

Hi can anybody help me regarding this.. i want know the output of ps -ef with explanation. how can we know the running processess. this is the output of ps -elf F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 19 T root 0 0 0 0 SY ... (1 Reply)
Discussion started by: rajesh_pola
1 Replies

6. UNIX for Dummies Questions & Answers

Query on Running Multiple processes in background

HI All , Pardon me for asking some very basic questions, I would be grateful if someone can help. I am trying to execute a shell script which runs multiple processes in background. It includes various operations like copying , DB operations etc etc. Now problem is that the complete script... (6 Replies)
Discussion started by: gpta_varun
6 Replies

7. Shell Programming and Scripting

Need help with running processes script

I'm doing a script with the Shell. I need that it only show the number of running processes. Ex: echo "There are `command` running processes" Thnx! Pd: Sorry the idiom. I'm spanish. (2 Replies)
Discussion started by: Ikebana
2 Replies

8. Shell Programming and Scripting

monitoring running processes

I have a script that runs continuously and will deliver a file to multiple servers via scp. On occasions one of the scp's will hang and as a result not complete in sending the remaining files and not loop around again. If I run the scp commands with a & they'll complete, but I want to make sure... (2 Replies)
Discussion started by: nhatch
2 Replies

9. UNIX for Advanced & Expert Users

running processes with no hang up

Can we run a script in nohup which calls another script in nohup. eg Script1.sh #Script1 start nohup script2.sh . . . #end script1.sh Now can I do this nohup script1.sh Also is all scheduled processes (crontab entries) will run as nohup? Would appreciate if any one can... (3 Replies)
Discussion started by: yakyaj
3 Replies

10. Programming

how to view loaded shared libraries by running processes in linux

anybody knows how to view loaded shared libraries by running processes in linux enviornment? any command or tool ? thanks a lot (3 Replies)
Discussion started by: princelinux
3 Replies
Login or Register to Ask a Question