![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running scripts in parallel | nivas | Shell Programming and Scripting | 6 | 02-21-2008 05:44 AM |
| executing scripts by reading names from a file | konark | Shell Programming and Scripting | 3 | 11-08-2007 02:28 AM |
| Executing Shell Scripts | BuyoCat | UNIX for Dummies Questions & Answers | 1 | 09-07-2005 02:11 AM |
| executing variables in ksh scripts? | zedmelon | Shell Programming and Scripting | 3 | 08-06-2003 02:50 PM |
| executing perl scripts | vtran4270 | UNIX for Advanced & Expert Users | 2 | 08-27-2002 03:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Executing scripts in Parallel
Hi All,
I have 3 shell scripts, Script1,Script2 and Script3. Now I want to run Script1 and Script2 in parallel and Script3 should depend on successful completion of both Script1 and Script2. Could you please suggest an approach of acheiving this... Thanks in advance |
|
||||
|
simple polling approach (this master script itself may not run parallel, vulnerable to symlink attacks through unsafe tmp file creation, ...) Code:
#!/bin/bash # should work in most shells (script1; echo $? > /tmp/retval1 ) & script2 # both do now run in parallel # ... # well, after some time script2 will have finished, so well have to check whether 2 also has retval2=$? while [ $? -eq 0 ] do sleep 1s pidof script1 > /dev/null done retval1=`cat /tmp/retval1` if [ something about retval1 and retval2 ] then script3 fi Last edited by fabtagon; 06-05-2008 at 05:47 PM.. Reason: missed one point |
|
||||
|
Quote:
What does the line in "while loop" do ? pidof script1 > /dev/null |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|