[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I "set process group" at the shell level

Posted on 2002-04-17
7
Medium Priority
?
197 Views
Last Modified: 2010-04-21
Is there anyway at the shell level to start multiple background processes, each one in its own process group?
0
Comment
Question by:zebada
[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
  • 3
  • 3
7 Comments
 
LVL 5

Expert Comment

by:ecw
ID: 6950212
Running ksh or csh, background task are all in their own process group, its the way job control works.

What shell are you using?
0
 
LVL 6

Author Comment

by:zebada
ID: 6950229
I understand what it's for I just want to know if I can prevent it.

I know I can write a small C program to fork() and setpgrp() and spawn processes that way but I thought it would be easier to do via the shell if it is possible

I'm using ksh or csh I don't mind. (On HPUX and Tru64)

I have an application that is started multiple times by a single shell script. These processes serve up html. The program has a "bug" in that if the server gets a SIGSEGV, it will re-send a SIGSEGV to all other servers in its process groups like this:

if ( sig==SIGSEGV )
  kill(0,sig);

I have removed this "stupid" piece of code but until the app can be redeployed on site I need some way to prevent a rogue process from taking out ALL the other web servers.

Any ideas?
0
 
LVL 5

Accepted Solution

by:
ecw earned 200 total points
ID: 6951467
By default interactive ksh's start put background jobs in a fresh process group, if the your running from s shell script, turn this feature on using
  set -m
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Author Comment

by:zebada
ID: 6951795
Yes, but this doesn't help me. Interactive ksh does put background processes in a "fresh" process group - meaning that the process group is different from the ksh process - but the process group is still the same for ALL background processes.
The -m option just controls whether or not the background processes' process group id is the same as the shell or not.
0
 
LVL 5

Expert Comment

by:ecw
ID: 6952982
Ok, hack it, do you need to maintain parent-child relationship with the foreground shell?  If not, maybe starting the other pipelines with eg.

  ksh -m -c "command | command &" &
0
 
LVL 21

Expert Comment

by:tfewster
ID: 7833732
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by ecw

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster (I don't work here, I'm just an Expert :-)
0
 
LVL 6

Author Comment

by:zebada
ID: 7833952
Sorry I didn't get back to this q.
-m did the trick :)
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.
Suggested Courses

649 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