0

I try to write a python script that will start a process and whenever an event occur the script terminates the process and relaunches it again after a delay.

In order to stop the process I use kill -15 (SIGTERM) followed by the pid of the process that I get with psutil. I have manually check that the pid is correct.

Once the kill command is issued I have found that the process is still alive and there are braces around its name. Like it goes from "zeek -i eth0" to "[zeek]".

I have also tried with SIGKILL but the result is the same.

Maybe it is relevant : the process is Zeek.

Once I tried to SIGKILL the process manually initially (when there is no braces) and it worked.

4bdl
  • 9
  • 5
  • 1
    Add a minimal subset of your actual code, showing how you call and kill the process. In any case your process is sleeping: it has likely stopped executing, but the container (for some reason) isn't dying. Have a look at `.kill` in the subprocess library. If you're going to do this in python, no point messing about with `psutil` just to get the pid – 2e0byo Sep 23 '21 at 15:14
  • https://docs.python.org/3/library/subprocess.html#subprocess.Popen.kill (and above for Popen first to create the process, though you're likely using that already). – 2e0byo Sep 23 '21 at 15:15

0 Answers0