0

I am trying to initiate the execution of monitor.pl by using this following pipe mechanism:

$cpid = open($fh, '-|', "./monitor.pl >/dev/null") or die "can not open pipe\n";

The output of monitor.pl is redirected to /dev/null.

The problem which I am facing is that I am not able to kill the processes even after using the following code:

kill ('INT', $cpid) if defined $cpid;
close $fh if defined $fh;

So please can anyone suggest me how to kill the process monitor.pl >/dev/null.

4

1 回答 1

0

/dev/null 不是一个进程,它是一个特殊文件。

但要杀死以下命令。monitor.pl >/dev/null

类型

ps -aef | grep monitor.pl
kill -9 PID of the process

这些是您可以在 perl 代码中轻松调整的命令。

于 2013-07-19T07:05:22.827 回答