Need to abort a perl script (make it die) - from another script.

ぐ巨炮叔叔 提交于 2019-12-12 00:22:46

问题


I need to abort a Perl script which is running in the background from another script.

Many perl scripts run on our machine. I need to abort one of the them on request. All I will know is the name of the perl script to abort. I need to abort that one particular script without affecting other processes.

I tried killing it using PID/Image Name but it did not work for the below reasons,

1)I do not know the PID of the script (as it runs from a trigger)

2)The script runs in the background, so the image name is always perl.exe and hence if image name is used , it kills all the other perl tasks as well.

I tried to get the perl script name from the 'windows title' and hence the corresponding PID, but it always shows 'NA'.

I even tried to delete the perl script(as I know the name and location) but it also did not work, as it runs the entire script from the memory (even though it is deleted)

Please help me with some options to kill the running perl, from another script.


回答1:


Your script may write its pid to special file for another script to use.



来源:https://stackoverflow.com/questions/17481882/need-to-abort-a-perl-script-make-it-die-from-another-script

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!