Run 2 shell scripts simultaneously from one script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run 2 shell scripts simultaneously from one script
# 8  
Old 02-19-2015
Thanku
But not working...

Now i running sh file like..
Code:
[KTTM:/home/view/bin] Mod_1.sh NODE_5
[KTTM:/home/view/bin] Mod_1.sh NODE_5

I want run..
Code:
[KTTM:/home/view/bin] Mod_New.sh NODE_5
.
.

In which Mod_New.sh will run both Mod_1.sh &Mod_1.sh file with unique input NODE_5

NODE may be..
NODE_5
NODE_6
NODE_7
NODE_8

I want to run both file from same script...

---------- Post updated at 03:40 AM ---------- Previous update was at 03:31 AM ----------

I know very less about SH scripting..........

Last edited by Scrutinizer; 02-19-2015 at 07:02 AM.. Reason: code tagz
# 9  
Old 02-19-2015
Please use code tags as required by forum rules!

Quote:
"But not working..."
doesn't help us help you. Please be very specific with error messages.

Does this work if executed IN your script:
Code:
Mod_1.sh NODE_5
Mod_2.sh NODE_5

?
Does this work if executed IN your script:
Code:
Mod_1.sh $1
Mod_2.sh $1

with NODE_5 supplied to your script as the first parameter?

Does this work if executed IN your script:
Code:
Mod_1.sh $1 &
Mod_2.sh $1 &

?
This User Gave Thanks to RudiC For This Post:
# 10  
Old 02-19-2015
its working fineeee
# 11  
Old 02-21-2015
HOW Can we run it for multiple nodes at once
like

Code:
Mod_1.sh NODE_5,6,7,8,10,11,55,48

---------- Post updated at 05:19 AM ---------- Previous update was at 01:08 AM ----------

Code:
Mod_1.sh NODE_5

for running above command My script is like...
Code:
Mod_1.sh $1
Mod_2.sh $1

HOW Can we run it for multiple nodes at once
like
Code:
Mod_1.sh NODE_5,6,7,8,10,11,55,48

?
?

Can any one help ??
Moderator's Comments:
Mod Comment Please use CODE tags (not ICODE tags) for multi-line input, output, and code segments.

Last edited by Don Cragun; 02-21-2015 at 07:56 AM.. Reason: Change ICODE tags to CODE tags.
# 12  
Old 02-21-2015
You do NOT want to name your script Mod_1.sh and have it invoke Mod_1.sh and Mod_2.sh. You are not ready to handle recursive scripts yet.

You could make your script relatively complex and try to parse the single operand you have suggested passing to your script...

Or, assuming that MOD is a constant in all of your calls and does not need to be passed as an operand to your script, you can make it simple on yourself and invoke your script something like this:
Code:
Mod_NEW.sh 5 6 7 8 10 11 55 48

with Mod_NEW.sh containing something like:
Code:
#!/bin/sh
for node in "$@"
do	Mod_1.sh MOD_"$node"
	Mod_2.sh MOD_"$node"
done

This will work with any shell that accepts basic Bourne shell syntax such as ash, bash, dash, and (my preferred shell) ksh.

Last edited by Don Cragun; 02-21-2015 at 08:17 AM.. Reason: Fix typo s/scrip/script/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run scripts parallely inside shell script?

Hi , I have 4 scripts example script1,script2,script3,script4 . I have to run script1,script2 and script3 parallely since this 3 scripts dont have dependencies . Once script1,script2 and script3 got completed successfully , I have to trigger script4. Can someone help me on this how to... (10 Replies)
Discussion started by: vinothsekark
10 Replies

2. Shell Programming and Scripting

Shell script for running simultaneously two interfaces

Hi! I have two environments on a machine and each one has some scripts for checking if some interfaces are down, and if so, it restarts them. The issue now is that i cannot keep both interfaces running, on both environments i see the same process running. How can i modify my scripts in... (4 Replies)
Discussion started by: Jane_Doe
4 Replies

3. Shell Programming and Scripting

Shell script to run all the python scripts from particular directory

I have N number of python scripts which i am receiving from REST web server and i am saving them in /home/mandar/ . Now i want to write a script to run all the python scripts from this directory and monitor them every minute...if any process is dead or hung it should be restarted by this script. ... (0 Replies)
Discussion started by: Mandar Nandale
0 Replies

4. Shell Programming and Scripting

Behavior of Unix in calling 2 scripts simultaneously

Hi, I wanted to know the exact behavior of the shell scripts in the below scenario. I have 2 scripts - a.ksh and b.ksh Both these scripts call a 3rd script xyz.ksh. What will happen if both a.ksh and b.ksh run at the same time? What will happen if a.ksh starts 2-3 seconds before b.ksh?... (3 Replies)
Discussion started by: aster007
3 Replies

5. Shell Programming and Scripting

[Help] script how to run 2 commands simultaneously

#!/bin/sh firefox index.html firefox secondpage.html hey guys, im not able to open up two pages at the same time... it always open up index.html first, and only after i close it, then the 2nd page pops up... is there any way i can run both commands at the same time? i appreciate any... (2 Replies)
Discussion started by: funnyguy123
2 Replies

6. Shell Programming and Scripting

To call many scripts from mother one simultaneously

Hi, I need to rin few other scripts from one main (mather) script. Working in ksh on LINUX. The only one condition - it should be run in parallel. I mean I have to be able to call 20 scripts from this mother script in parallel (start them in the same time). Does somebody know how to do it? ... (2 Replies)
Discussion started by: juliyp
2 Replies

7. Shell Programming and Scripting

Run a command in bg simultaneously with

Hi, I want to run the command below in the background: tail -f file.txt | grep "pattern" The file file.txt will start getting its contents written after this command has started getting run. So the flow will be like this tail -f file.txt | grep "pattern" #The line below will write data... (0 Replies)
Discussion started by: King Nothing
0 Replies

8. Shell Programming and Scripting

run serveral loops simultaneously?

Hello everyone, say I have the following script, which contains serveral loops, if I run the script, it executes the loop one by one (after the a loop, it goes to b loop, then c, then d) I figured I should be able to run all the loops at same time, but I don't know how, can anyone help a little... (2 Replies)
Discussion started by: fedora
2 Replies

9. Shell Programming and Scripting

sequentially run the shell scripts.

Hi All, I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script. This same rule applies to script3 and script4. Can someone... (4 Replies)
Discussion started by: nua7
4 Replies

10. Linux

Possible ways to run shell scripts on Windows

Hi all, I want to know possible ways to exceute the shell scripts on Windows environment. Please help me. Regards, Uday. (2 Replies)
Discussion started by: uday123
2 Replies
Login or Register to Ask a Question