0

This seems like it should be simple, but I can't seem to find out how to do this. I have an x11vnc server running on Ubuntu 20.04 inside a docker container, and I want to stop the x11vnc server so I can then start it as a non-root user. The x11vnc server was started with the -forever argument, and I suspect that's why killing it with kill -9 [PROCESS_ID] simply results in it restarting itself automatically.

Googling how to stop it just returns a gazillion results on how to prevent it from stopping, but I want the opposite.

Is there a simple way to stop this? I don't care about restarting it. I just want it to stop.

jmort253
  • 285
  • 2
  • 13
  • 2
    The `kill` command takes process IDs, not port numbers as parameters. You may have simply misaimed your kill command. And since `kill -9` is a direct order for the OS kernel to "stop giving any more CPU time to this process and clean it up forcibly", the only way to escape it would be to have another process restart the killed one, and vice versa. – telcoM Jun 20 '20 at 14:54
  • Relating https://unix.stackexchange.com/q/115107/117549 – Jeff Schaller Jun 20 '20 at 15:03
  • @telcoM thanks for pointing that out. I was using the process id in the terminal, but when writing the question, I wrote it mistakenly as port number and have edited the question to fix that. The process does get killed and then restarts with a new PID, so I am sure I ran kill correctly and that it's the -forever flag that's causing the stopped program to immediately restart. – jmort253 Jun 20 '20 at 15:09
  • @JeffSchaller I did see that question, but from what I understand, in all of those answers, the end game is that x11vnc restarts. I just want to stop it so I can restart it on my own terms, like as a non-root user. – jmort253 Jun 20 '20 at 15:10
  • The two answers with the -stop and -clear-all don't work for me. The arguments are ignored. – jmort253 Jun 20 '20 at 15:13
  • No process can catch a `-9`. That means that another process is (re)starting it. How do you start it? A script, a systemd unit, ... You can run `ps fax` for example, to see who is the parent process, that might give you an idea. – Eduardo Trápani Jun 20 '20 at 15:27
  • Did you try something like `pkill -9 x11vnc` or see if it has a service? – Pheric Jun 20 '20 at 22:25

0 Answers0