Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Enq in shell scripts

Posted on 1998-11-14
1
Medium Priority
?
256 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 300 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

618 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