Search the web
Sign In
New User? Sign Up
Perl_Official · Perl . CGI . Shell script
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Regarding killing process   Message List  
Reply | Forward Message #2034 of 2062 |
[Perl] Re: Regarding killing process

Avinash,

The last suggestion which surrounded the kill command with grave
accents (`kill -9 PID`) was essentially causing perl to spawn a
process and running UNIX kill command. If this fails to work, then
your problem has nothing to do with perl. Check the following:

1) Make sure that the value that $pid[$_] evaluates to is in fact the
process number of some existing process. You might want to go back to
your original version to verify what the value is. You should get the
word kill (all lower case).

2) The perl kill function takes small positive integer values for the
various signals, whereas with the UNIX shell level kill command, the
signal value is immediately preceded by a dash. Using a negative value
means to send the signal to all the members of a process group which
is likely NOT what you intended to do. Perl documentation cannot tell
you what will happen or exactly what values to use. You MUST consult
your UNIX documentation with the man command (see below).

3) Please be aware that any process in a Unix/Linux system cannot kill
(i.e., send a signal to another process) unless that other process has
permission to do so. If you try typing an explicit kill -9 PID command
at the shell and the process does not die, then you do not have
permission to kill it. I won't attempt to explain how the permission
system works, nor the details of what processes generally are able to
send signals to other processes other than to say that the ROOT (super
user) can do anything, whereas most other processes can only send
signals to other processes created by the same user.

4) If you are not familiar with what signals are or how the
permissions system works with UNIX, then you might want to consult
your online documentation. Type: man kill <return> to get started.

5) Should you want to get better results from using a group like this,
be sure that you have a decent grasp of your problem first and provide
us with the essential information. There is nothing magical about
Perl's kill command, since it most assuredly invokes the local Unix
system kernel using the same system call that the shell's kill command
does. Any properly installed UNIX or UNIX derivative system like
Cygwin or Linux should have manual pages. If the specific manual page
you view doesn't provide you with the clue you need, then go to the
bottom of the manual page and check one or more cross referenced
pages. Also, if you perform any tests, provide us with enough clues of
what happens so that we can be of help to you, otherwise you're just
wasting your time and ours.

Good luck,
Glen

--- In Perl_Official@yahoogroups.com, avinash k <avik1612@...> wrote:
>
> hi,
>
> i am using the unix opearting system.
> I have attached the code
> It is still not able to kill the process
>
> Thanks in advance
> Avinash
>
> rob_wilson_98 <no_reply@yahoogroups.com> wrote:
> --- In Perl_Official@yahoogroups.com, avinash k
<avik1612@> wrote:
> >
> > hi,
> >
> > i am trying this statement but it is not executing i.e. killing
> process
> >
> > $force ="-9";
> >
> > print "Kill $force $pid[$_]\n";
> >
> >
> > Thanks and Regards
> > Avinash
> >
> >
>
> All your script would do is print out a Kill message. It will not
> execute the Kill command. In fact, I am not aware of a "Kill"
> command. If you're on Windows, you must have some sort of unix-like
> toolkit involved and then you'd probably still need the "kill" command
> - note no capitalization. On Unix things are case-sensitive so you
> have to use the "kill" command. It also has to be in your path (it
> normally is by default).
>
> Perhaps you're looking for something like:
>
> $force = "-9";
> `kill $force $pid[$_]`;
>
> If that's not what you want, post more information such as the OS,
> what you're trying to accomplish, and what _exactly_ seems to be the
> problem (error messages, observed behavior, output from "use strict"
> or "-w", etc.
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------
> Once upon a time there was 1 GB storage in your inbox. Click here
for happy ending.
>
> [Non-text portions of this message have been removed]
>





Mon Aug 13, 2007 6:10 pm

glen_brydon
Offline Offline
Send Email Send Email

Forward
Message #2034 of 2062 |
Expand Messages Author Sort by Date

hi, i am trying this statement but it is not executing i.e. killing process $force ="-9"; print "Kill $force $pid[$_]\n"; Thanks and Regards Avinash ... Get...
avinash k
avik1612
Offline Send Email
Aug 10, 2007
12:02 am

... process ... All your script would do is print out a Kill message. It will not execute the Kill command. In fact, I am not aware of a "Kill" command. If...
rob_wilson_98
Online Now
Aug 10, 2007
2:13 pm

hi, i am using the unix opearting system. I have attached the code It is still not able to kill the process Thanks in advance Avinash ... process ... All your...
avinash k
avik1612
Offline Send Email
Aug 13, 2007
3:39 pm

... The code may have gotten stripped as a "non-text attachment". Try pasting the relevant portion(s) in-line. A few things could keep you from being able to...
rob_wilson_98
Online Now
Aug 14, 2007
2:22 pm

Avinash, The last suggestion which surrounded the kill command with grave accents (`kill -9 PID`) was essentially causing perl to spawn a process and running...
Glen
glen_brydon
Offline Send Email
Aug 14, 2007
3:43 pm

... Glen> The last suggestion which surrounded the kill command with grave Glen> accents (`kill -9 PID`) was essentially causing perl to spawn a Glen> process...
merlyn@...
merlynstoneh...
Offline Send Email
Aug 14, 2007
5:59 pm

hi, i am killing all the process that are displayed using the ps command. but doing that the particular unix session also terminates. so how to prevent the...
avinash k
avik1612
Offline Send Email
Aug 16, 2007
11:07 pm

try this `kill $force $pid[$_]`; ... -- Kind Regards Dhanapalan.C " If there is a way, I will find one, If there is none,I will make one.... !!! " [Non-text...
dp
dhana_foru
Offline Send Email
Aug 10, 2007
6:19 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help