When running in console
Geth can be stopped by sending it a keyboard interrupt with Ctrl + c
. You should see output similar to the following.
I0127 09:46:49.971487 62813 blockchain.go:1230] imported 1 block(s) (0 queued 0 ignored) including 0 txs in 2.836192ms. #913170 [2eb50f50 / 2eb50f50]
^C
I0127 09:46:54.258683 62813 cmd.go:123] Got interrupt, shutting down...
I0127 09:46:54.259731 62813 blockchain.go:677] Chain manager stopped
I0127 09:46:54.259774 62813 handler.go:191] Stopping ethereum protocol handler...
I0127 09:46:54.259797 62813 handler.go:201] Ethereum protocol handler stopped
I0127 09:46:54.259813 62813 transaction_pool.go:150] Transaction pool stopped
I0127 09:46:54.259831 62813 backend.go:630] Automatic pregeneration of ethash DAG OFF (ethash dir: /home/user/.ethash)
I0127 09:46:54.260551 62813 database.go:158] closed db: /home/user/.ethereum/chaindata
I0127 09:46:54.260716 62813 database.go:158] closed db: /home/user/.ethereum/dapp
In the event that go-ethereum receives multiple interrupts before shutting down cleanly, you should see something like this.
I0127 09:50:47.173412 63063 cmd.go:129] Already shutting down, please be patient.
I0127 09:50:47.173433 63063 cmd.go:130] Interrupt 9 more times to induce panic.
In this case if you continue to hit Ctrl + c
to force the process to quit you may corrupt the underlying databases that go-ethereum maintains.
Killing a Daemon Process
If the process is running as a daemon, then you can kill it with kill -INT <pid>
where <pid
is the process id for the running geth
process.
One way to find the process id is with ps aux | grep geth
.
$ ps aux | grep geth
user 63353 91.2 0.2 573457444 29844 s019 R+ 10:15AM 0:01.97 geth --rpc
user 63355 0.0 0.0 2434836 780 s021 S+ 10:15AM 0:00.00 grep geth
Here the pid
that should be killed is 63353
.