Solved

Using Enq in shell scripts

Posted on 1998-11-14
1
253 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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.

688 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