yeah sort of a HW, but more of a prac program. so far I have tried this - should the fork() be in a separate loop, like first create all processes and then print random integer and at last terminate.
int Myproc(int id) // couldn't figure out this part.
Hello all,
I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted.
Thanks in advance
Regards,
pradeep kulkarni.
:mad: (13 Replies)
Hello member's
I'm learning to script in the ksh environment on a Solaris Box.
I have 10 files in a directory that I need to pass, as input to a batch job one by one. lets say, the files are named as follows:
abcd.txt ; efgh.bat ; wxyz.temp etc. (random filenames with varied extensions ).... (1 Reply)
Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it
This is how we execute the script (and this is the requirement) ... (2 Replies)
get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same.
hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Hello All, I am stuck up in a program where the rand functions ends up giving all the same integers. Tried sleep, but the numbers turned out to be same... Can anyone help me out how to fix this issue ? I have called the srand once in the program, but I feel like when I call fork the child process... (5 Replies)
Hi Experts,
I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state.
On doing cat /proc/<pid>wchan showing the "__init_begin" in the output.
Can you please help me here... (0 Replies)
Hi Experts,
I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state.
On doing cat /proc/<pid>wchan showing the "__init_begin" in the output.
Can you please help me here... (1 Reply)
I am trying to start troubleshooting an error on a virtual server that uses the ubuntu 14.04 OS. Basically what happens (seeming random) is that the GPU stops processing and terminates. What Imean by seeming random is that for 3 runs there is no error then on run 4 the error appears. It has... (2 Replies)
I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues:
1. Monitor all Processes parallelly.... (5 Replies)
Team,
I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list.
How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies
LEARN ABOUT MOJAVE
child
Child(3pm) User Contributed Perl Documentation Child(3pm)NAME
Child - Object oriented simple interface to fork()
DESCRIPTION
Fork is too low level, and difficult to manage. Often people forget to exit at the end, reap their children, and check exit status. The
problem is the low level functions provided to do these things. Throw in pipes for IPC and you just have a pile of things nobody wants to
think about.
Child is an Object Oriented interface to fork. It provides a clean way to start a child process, and manage it afterwords. It provides
methods for running, waiting, killing, checking, and even communicating with a child process.
NOTE: kill() is unpredictable on windows, strawberry perl sends the kill signal to the parent as well as the child.
SYNOPSIS
BASIC
use Child;
my $child = Child->new(sub {
my ( $parent ) = @_;
....
# exit() is called for you at the end.
});
my $proc = $child->start
# Kill the child if it is not done
$proc->complete || $proc->kill(9);
$proc->wait; #blocking
IPC
# Build with IPC
my $child2 = Child->new(sub {
my $self = shift;
$self->say("message1");
$self->say("message2");
my $reply = $self->read(1);
}, pipe => 1 );
my $proc2 = $child2->start;
# Read (blocking)
my $message1 = $proc2->read();
my $message2 = $proc2->read();
$proc2->say("reply");
SHORTCUT
Child can export the child() shortcut function when requested. This function creates and starts the child process in one action.
use Child qw/child/;
my $proc = child {
my $parent = shift;
...
};
You can also request IPC:
use Child qw/child/;
my $child = child {
my $parent = shift;
...
} pipe => 1;
DETAILS
First you define a child, you do this by constructing a Child object. Defining a child does not start a new process, it is just the way to
define what the new process will look like. Once you have defined the child you can start the process by calling $child->start(). One child
object can start as many processes as you like.
When you start a child an Child::Link::Proc object is returned. This object provides multiple useful methods for interacting with your
process. Within the process itself an Child::Link::Parent is created and passed as the only parameter to the function used to define the
child. The parent object is how the child interacts with its parent.
PROCESS MANAGEMENT METHODS
@procs = Child->all_procs()
Get a list of all the processes that have been started. This list is cleared in processes when they are started; that is a child will
not list its siblings.
@pids = Child->all_proc_pids()
Get a list of all the pids of processes that have been started.
Child->wait_all()
Call wait() on all processes.
EXPORTS
$proc = child( sub { ... } )
$proc = child { ... }
$proc = child( sub { ... }, $plugin, @data )
$proc = child { ... } $plugin => @data
Create and start a process in one action.
CONSTRUCTOR
$child = Child->new( sub { ... } )
$child = Child->new( sub { ... }, $plugin, @plugin_data )
Create a new Child object. Does not start the child.
OBJECT METHODS
$proc = $child->start()
Start the child process.
SEE ALSO
Child::Link::Proc
The proc object that is returned by $child->start()
Child::Link::Parent
The parent object that is provided as the argumunt to the function used to define the child.
Child::Link::IPC
The base class for IPC plugin link objects. This provides the IPC methods.
HISTORY
Most of this was part of Parrallel::Runner intended for use in the Fennec project. Fennec is being broken into multiple parts, this is one
such part.
FENNEC PROJECT
This module is part of the Fennec project. See Fennec for more details. Fennec is a project to develop an extendable and powerful testing
framework. Together the tools that make up the Fennec framework provide a potent testing environment.
The tools provided by Fennec are also useful on their own. Sometimes a tool created for Fennec is useful outside the greator framework.
Such tools are turned into their own projects. This is one such project.
Fennec - The core framework
The primary Fennec project that ties them all together.
AUTHORS
Chad Granum exodist7@gmail.com
COPYRIGHT
Copyright (C) 2010 Chad Granum
Child is free software; Standard perl licence.
Child is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
perl v5.10.1 2011-03-07 Child(3pm)