Sponsored Content
Top Forums Programming spawning multiple processes spread across two files Post 302136400 by StrengthThaDon on Monday 17th of September 2007 03:36:02 PM
Old 09-17-2007
spawning multiple processes spread across two files

I want to spawn n child processes but have two different classes..with the foremost one forking/spawning the child process and the latter performing a function w/ the spawned processes.

I can do this in one class with an if statement and the simple

if((pid=fork())==0) //child process
{
//do code
}

else
{
//do code as parent process.
}
In doing in w/ two different classes would I need to pass fork() to the slave class? I don't to fork my main process and have it execute the same code as the parent process I want it to execute its own code. That's why I want a separate child/slave class.

also is there a way to JUST spawn children? I don't understand why fork() would create parent processes.
Hopefully my problem isn't too convoluted, thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Can I spread commands over multiple lines?

Below an example of what I mean. The first attempt does what I want; the second doesn't, because bash assumes a line break means the end of an individual "command unix". Is there some way that I can convince bash to parse out, eg, to the closing parenthesis? I'm thinking this would allow for... (1 Reply)
Discussion started by: tphyahoo
1 Replies

2. Shell Programming and Scripting

Spawning multiple threads in Unix

Hi, I need to spawn mutilpe threads , each invoking a different set of shell scripts, in parallel. What would be the best way to do that. Any sample script would greatly help. I am a novice at Unix so any help is much appreciated. Thanks (5 Replies)
Discussion started by: neeto
5 Replies

3. Shell Programming and Scripting

removing pattern which is spread in multiple lines

I have several huge files wich contains oracle table creation scripts as follows: I would need to remove the pattern colored in red above. Any sed/awk/pearl code will be of much help. Thanks (2 Replies)
Discussion started by: sabyasm
2 Replies

4. UNIX for Advanced & Expert Users

Crontab spawning multiple at processes

Hi - I need help. My user crontab is spawning multiple at processes (and multiple mencoder program starts, that exit, then restart, repeatedly), locking up my system. For example I have this entry in my crontab: $ sudo crontab -u victoria -e * * * * * ~/recordings/pvr1 * * * * *... (10 Replies)
Discussion started by: gstuart
10 Replies

5. Shell Programming and Scripting

search for a string spread in multiple line

Hi, I have to look for the full string below in a large file(>5GB) , but that string may be spread in two lines. string :-- "f8f8 f5f0 f0f0 f1f7 f4f7 f7c1" By grep "f8f8 f5f0 f0f0 f1f7 f4f7 f7c1" file | tail -1 , I am getting incorrect result because there is a line after this also which... (1 Reply)
Discussion started by: finder255
1 Replies

6. UNIX for Advanced & Expert Users

Help! imapd is spawning multiple processes, all of a sudden, for no reason!

Hi All, I need some assistance, if possible... Our IMAP server has recently (as of 10:30 GMT today) started spawning multiple processes for no reason! This is causing the mail server's load average to increase continually until the whole machine grinds to a halt. Here is a typical... (0 Replies)
Discussion started by: fishsponge
0 Replies

7. Shell Programming and Scripting

[AWK] handeling data spread on multiple lines

Hello all, first off great forum. Now for my little problem. Using RHEL 5.4 and awk. Been doing code since a few month. So just starting. My problem is handeling data on multiple lines. { if ($1 != LASTKEY && h ~ /.*\/s_fr_/) { checkgecos( h, h ) h="" ... (2 Replies)
Discussion started by: maverick72
2 Replies

8. AIX

Multiple pconsole processes spawning indefinetly

Good night everyone, I've been trying to make AD authentication work with RBAC and I think I messed my test LPAR up. I've manually modified the /etc/security/user.roles file, adding a role to one of my AD users (who is not defined locally) and then runned setkst. It worked fine, but now I found... (3 Replies)
Discussion started by: Janpol
3 Replies

9. Shell Programming and Scripting

Shell script executed from Informatica ETL tool is spawning 2 processes for one script

Hi, I am having a shell script which has a while loop as shown below. while do sleep 60 done I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Discussion started by: chekusi
2 Replies

10. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies
spawn-fcgi(1)						      General Commands Manual						     spawn-fcgi(1)

NAME
spawn-fcgi - Spawns FastCGI processes SYNOPSIS
spawn-fcgi [options] [ -- <fcgiapp> [fcgi app arguments]] spawn-fcgi -v spawn-fcgi -h DESCRIPTION
spawn-fcgi is used to spawn remote and local FastCGI processes. While it is obviously needed to spawn remote FastCGI backends (the web server can only spawn local ones), it is recommended to spawn local backends with spawn-fcgi, too. Reasons why you may want to use spawn-fcgi instead of something else: * Privilege separation without needing a suid-binary or running a server as root. * You can restart your web server and the FastCGI applications without restarting the others. * You can run them in different chroot()s. * Running your FastCGI applications doesn't depend on the web server you are running, which allows for easier testing of other web servers. OPTIONS
spawn-fcgi accepts the following options: -f <path> Filename of the FastCGI application to spawn. This option is deprecated and it is recommend to always specify the application (absolute path) and its parameters after "--"; the fcgiapp parameter is directly used for the exec() call, while for starting the binary given with -f /bin/sh is needed (which may not be available in a chroot). This option is ignored if fcgiapp is given. -d <path> Change the current directory before spawning the application. -a <address> IPv4/IPv6 address to bind to; only used if -p is given too. Defaults to "0.0.0.0" (IPv4). -p <port> TCP port to bind to; you cannot combine this with the -s option. -s <path> Path to the Unix domain socket to bind to; you cannot combine this with the -p option. -C <children> (PHP only) Number of children to spawn by setting the PHP_FCGI_CHILDREN environment variable. Default is not to overwrite the envi- ronment variable; php will spawn no children if the variable is not set (same as setting it to 0). -F <children> Number of children to fork, defaults to 1. This option doesn't work with -n, have a look at multiwatch(1) if you want to supervise multiple forks on the same socket. -P <path> Name of the PID file for spawned processes (ignored in no-fork mode) -n No forking should take place (for daemontools) -M <mode> Change file mode of the Unix domain socket; only used if -s is given too. -?, -h General usage instructions -v Shows version information and exits The following options are only available if you invoke spawn-fcgi as root: -c <directory> Chroot to specified directory; the Unix domain socket is created inside the chroot unless -S is given. -S Create Unix domain socket before chroot(). -u User ID to change to. -g Group ID to change to. Defaults to primary group of the user given for -u. -U Change user of the Unix domain socket, defaults to the value of -u. (only used if -s is given) -G Change group of the Unix domain socket, defaults to the primary group of the user given for -U; if -U wasn't given, defaults to the value of -g. (only used if -s is given) SEE ALSO
svc(8), supervise(8), see http://cr.yp.to/daemontools.html multiwatch(1), see http://cgit.stbuehler.de/gitosis/multiwatch/about/ 26 March 2009 spawn-fcgi(1)
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy