Rsai has asked for the wisdom of the Perl Monks concerning the following question:

Hi Gurus, I am trying to list the processes for a specific user and kill just one among them. Can any body please help me. Your help is greatly appreciated. Thanks
  • Comment on How to list the processes for specific user and kill just one process

Replies are listed 'Best First'.
Re: How to list the processes for specific user and kill just one process
by Corion (Patriarch) on Oct 27, 2010 at 16:23 UTC

    See perlfunc about the kill function.

    This advice is general, because you haven't given us much to work with. If you want more specific help, please show us what code you've already written and how it fails to work.

Re: How to list the processes for specific user and kill just one process
by roboticus (Chancellor) on Oct 27, 2010 at 16:23 UTC

    Rsai:

    That would depend on your operating system. You should search CPAN for your operating system name and process and see what pops up. For example, "windows process" gives you links to Windows::Process::Info, Win32, etc. Looking through the packages you turn up will let you know if there's a package to do the trick.

    ...roboticus

Re: How to list the processes for specific user and kill just one process
by Tux (Canon) on Oct 27, 2010 at 18:35 UTC

    And on Linux/Unix, you could use Proc::ProcessTable to find the process and kill () to kill it.

    Be careful. Version 0.45 will fail if you have a non-threaded perl (it should be removed from CPAN IMHO). Version 0.44 will work fine on non-threaded perl.


    Enjoy, Have FUN! H.Merijn