Solved

Using Enq in shell scripts

Posted on 1998-11-14
1
250 Views
Last Modified: 2008-03-10
I need to write a shell script that starts several parallel processes in the background. Then it must wait untill all of them are finished. After that it must continue its operation.
I'm not sure if I can manipulate with semafores in shell script. Is it possible? If yes I'd like to get a code example.
If semafores are not accessible in a shell script, what would be the best way to implement this enqueue logic?
0
Comment
Question by:mgokman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 2007842
There is no access to semaphores from within shell scripts without using other tools (perl, tcl).

But you may simply start your sub-processes in background and the check in a loop if there still some running using:

    jobs

NOTE that  jobs  may not list what you want if your started process is a deamon which detaches itself from the controlling terminal.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux : adding the new user with password option, 11 123
OpenLDAP Proxy to Active Directy 6 453
Sed question 2 122
lunix and unix command 21 115
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question