How do you stop a running geth node?

  • I can not figure out how to stop a running geth node without killing the process. I tried to lookup geth help but there is no mention of stopping, halting or any shutdown command.

    How to shutdown geth cleanly?


    I'm running it as a daemon, CTRL+C is no option.

    And how do I stop it if the Wallet crashed and Geth is still running as task in Windows? I use the task manager and stop the task but I fear it could harm something (even so it looks like it did not when I had to use it several times before).

  • makevoid

    makevoid Correct answer

    5 years ago

    Because you ran geth as a daemon you can either:

    killall -HUP geth

    in one line, or get the pid with:

    ps ax | grep geth

    and kill it with kill

    kill -HUP <pid>

    -HUP is the sighup signal, is optional but is more gentle than the normal TERM signal.

    +1 for using `-HUP`.

    Instead of running `ps` and piping it to `grep`, you can use `pgrep geth`. One-liner: `kill -HUP $(pgrep geth)`.

    Or even `pkill -HUP geth`

    It continuously resurrect after kill

    If you check the code of Geth only SIGINT and SIGTERM are supported for graceful shutdown. SIGHUP should not be used and ongoing with Geth 1.10.0 you'll get a warning at the next start that Geth did not shutdown propperly if you do so. There was also a discussion about this in the GitHub issues and ultimately it was decided to only support those two signals.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM