The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Identifying and grouping OS processes and APP processes wilsonee SUN Solaris 2 09-30-2008 09:26 AM
Monitoring Processes - Killing hung processes ukndoit UNIX for Advanced & Expert Users 4 01-17-2008 04:30 AM
Processes Beetlejuice UNIX for Dummies Questions & Answers 4 04-06-2005 12:33 PM
processes master_6ez Shell Programming and Scripting 3 11-24-2004 09:48 AM
processes mma_buc_98 UNIX for Dummies Questions & Answers 1 08-13-2002 05:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-26-2002
google's Avatar
google google is offline Forum Advisor  
Moderator
  
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
co-processes

Is it possible to have a main script (i will call it main.ksh) that executes say, 4 other scripts (sub_prog_1.ksh, sub_prog_2.ksh etc..) from within this main.ksh (simultaneously/in parallel), have them run in the background and communicate back to main.ksh when complete?

My guess is to use co-processes and do the communication between main and sub by redirecting output to a file descriptor which would be used by main. Is this correct?

the 4 sub-scripts would be calling and executing stored procedures and such, and it would be nice to have them execute concurrently. current setup uses a scheduling program (Maestro) to kick off jobs.

Last edited by google; 07-27-2002 at 08:50 AM..
  #2 (permalink)  
Old 07-27-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
It is possible, but I would not use co-processes. I would just use background jobs.

The main script can remember the pid's of the background jobs that it launches. By doing "kill -0 $pid 2> /dev/null" and then checking the $? variable, it can monitor them to see if they are still running. The kill will do nothing except succeed if the process is still running. And it will fail if the process has exited. Since kill is a ksh built-in, this is not an expensive test.

It would be very hard for the background jobs to asyncronously notify the main script as they finish. If you really want to do that, you will need signal handlers. It is much better if the main script just polls the background jobs.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0