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?
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?
use killall to kill processes by process names. if you have to use perl. do a system call from within there.
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.