04-13-2006
Let's say that the pid is 1612. So you set tcpid to 1612 and then you enter your loop. On the first iteration you kill the process. After the process dies, the value of $tcpid will not magically change values for you. It is still 1612. It will stay 1612 forever since you don't assign it a new value in the loop.
What is the point of the loop anyway? If a process survived a "kill -9", do you think that second "kill -9" will work any better?
9 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
can anyone send me enything about "unix process control "
nicko@freemail.com.mk (2 Replies)
Discussion started by: nicko
2 Replies
2. Programming
Hello,
I want to know what call to use to read the details of a process control block in solaris ?:) (2 Replies)
Discussion started by: hmurali
2 Replies
3. UNIX for Advanced & Expert Users
I found that in my system , there are some strange process , it will make the system crash so I would like to control the system no such process is running ,
this is if the system process that its process name is "ora" AND its ppid is not "2" , then it will crash the system, can suggest how to... (2 Replies)
Discussion started by: ust
2 Replies
4. UNIX for Dummies Questions & Answers
I'm trying to wrap my head around process control in Unix... particularly init and how it fits in to the equation. Init is responsible for creating sessions by spawning instances of getty which calls login effectively creating sessions right? Why then can init belong to a session? If you ps jx... (4 Replies)
Discussion started by: dexfantasy
4 Replies
5. Shell Programming and Scripting
Dear all,
I want to control my server from shutting down and rebooting.
It will ask for some question before the process, ex: who are you? what is the reason for shutting down? ...
I think I can overide that binary of shutdown/reboot command, but it is confused.
We have many way to... (5 Replies)
Discussion started by: fongthai
5 Replies
6. UNIX for Advanced & Expert Users
I pressed CTRL Z and suspended the job. then I pressed bg, The process re-started to throw output on the terminal and its not allowing me to access the prompt.
its not even accepting CTRL Z. The process has been running for about 2 hours now and I want to suspend it by opening another terminal.... (3 Replies)
Discussion started by: rakeshou
3 Replies
7. Shell Programming and Scripting
Hi forum,
I have a problem concerning job or process scheduling and control.
I have to run 24 jobs (could be more sometimes less) of the same programme with different parameters. The machine this code is running on is an 8-core machine, so I was thinking that running all the processes at once... (0 Replies)
Discussion started by: deiphon
0 Replies
8. Shell Programming and Scripting
Hi,
I'm using simple sqlplus to test DB availability.
When DB is going down, sqlplus command is hang for a few minutes
I want to implement the following:
1. execute sqlplus
2. if after 20 sec I dont get a response, kill the process and exit with error.
3. if I get immediate response... (2 Replies)
Discussion started by: gdan2000
2 Replies
9. Shell Programming and Scripting
Hi Friends,
Iam invoking another shell script to create B2k_session_id from my shell script.It is properly creating B2k_session_id and after creation control is coming out from the script and going to command prompt.The lines which are after the exectrusteduser.com sh.com are not executing..may... (5 Replies)
Discussion started by: vadlamudy
5 Replies
LEARN ABOUT DEBIAN
io::async::pid
IO::Async::PID(3pm) User Contributed Perl Documentation IO::Async::PID(3pm)
NAME
"IO::Async::PID" - event callback on exit of a child process
SYNOPSIS
use IO::Async::PID;
use POSIX qw( WEXITSTATUS );
use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
my $kid = $loop->fork(
code => sub {
print "Child sleeping..
";
sleep 10;
print "Child exiting
";
return 20;
},
);
print "Child process $kid started
";
my $pid = IO::Async::PID->new(
pid => $kid,
on_exit => sub {
my ( $self, $exitcode ) = @_;
printf "Child process %d exited with status %d
",
$self->pid, WEXITSTATUS($exitcode);
},
);
$loop->add( $pid );
$loop->run;
DESCRIPTION
This subclass of IO::Async::Notifier invokes its callback when a process exits.
For most use cases, a IO::Async::Process object provides more control of setting up the process, connecting filehandles to it, sending data
to and receiving data from it.
EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters:
on_exit $exitcode
Invoked when the watched process exits.
PARAMETERS
The following named parameters may be passed to "new" or "configure":
pid => INT
The process ID to watch. Must be given before the object has been added to the containing "IO::Async::Loop" object.
on_exit => CODE
CODE reference for the "on_exit" event.
Once the "on_exit" continuation has been invoked, the "IO::Async::PID" object is removed from the containing "IO::Async::Loop" object.
METHODS
$process_id = $pid->pid
Returns the underlying process ID
$pid->kill( $signal )
Sends a signal to the process
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>
perl v5.14.2 2012-10-24 IO::Async::PID(3pm)