How to kill a running process ?
gotcha1 (0)

I have started a Plone server via the repl.it shell.
I have closed the repl.it page with the server still running: http://ploneinrepl--gotcha1.repl.co
If I open the repl again and open the shell, how can I kill the running process ?

You are viewing a single comment. View All
TheDrone7 (604)

You won't be able to kill the process from the shell. The two easiest ways to do it are:-
1. Wait for 1 hour for it to kill itself.
2. Write 1 or 2 words deliberately to make the code buggy, then restart.

gotcha1 (0)

@TheDrone7 Thanks for your answer.
Trying 2, I have saved broken code for main.py and clicked the green start button.
This nicely fails in the python interpreter but does not kill the server started via the shell.

TheDrone7 (604)

@gotcha1 if you've started it via shell Ctrl + C to kill it.

gotcha1 (0)

@TheDrone7 which I could do if I did not have quit the repl opened in browser.
When I get back to my repl, I get a new shell without access to the running process... or at least, I do not know how to get access to it.
Which is why I ask how to kill it.

TheDrone7 (604)

@gotcha1 the only way I can think of now is to fork the repl and use the new one after deleting the old one.

PythinPython (6)

@gotcha1 If I am understanding you correctly then I believe there is no efficient way to kill it. But if you wait for a while the program will stop responding and in a way kill itself (like what TheDrone7 said).

Vandesm14 (908)

@PythinPython Can't you do top in the shell, get the pid of the process, and type kill [pid]?

gotcha1 (0)

@Vandesm14 I had not thought of top. However, neither top, neither ps commands are available in the shell.

TheDrone7 (604)

@Vandesm14 that would require superuser permissions and repl.it doesn't give you that.

TheDrone7 (604)

@PythinPython the repl won't go down on it's own either if started using the shell, unlike the normal repls, it stays up for a little longer than normally started ones. So the quicker way would be to fork it and continue working in the new one.

gotcha1 (0)

@TheDrone7 I have forked the repl as suggested.
For the record, if I run Plone in daemon mode and I write down its pid, I am able/allowed to kill it.

TheDrone7 (604)

@gotcha1 well that's good news. Last time I tried kill didn't go well for me.