开发者

How do I stop a process running using Perl? [closed]

开发者 https://www.devze.com 2023-01-05 02:27 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_C百科 Closed 10 years ago.

I want to write a Perl code that ends the process of another program of mine, running on Linux.

For example, I execute xxy.py and a process is opened for it. I would like to use Perl to close the process of xxy.py. What do I need to do?


Perl extensions are typically .pl or .pm right? .py is for python I think.

Anyway, you can kill a specified program in a Unix environment with something like:

system 'killall', 'some_program_name';

or

system 'kill', '-15', $pid;

if the variable $pid holds the pid of your program.


use killall to kill processes by process names. if you have to use perl. do a system call from within there.


See kill(1) and pkill(1) manual pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消