2

So I run

geth --testnet --rpc --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "eth,web3" console

But when I exit out of putty geth stops.

I tried to add:

--daemon

But it didn't work.

How do I keep geth running?

5
  • 2
    Hi there. This is a general Linux question, as opposed to anything specific to Ethereum, so I'm going to suggest it be closed as off-topic. The answer is to use screen, or a similar utility. Commented Jul 12, 2017 at 23:07
  • 2
    For example: superuser.com/questions/96660/… Commented Jul 12, 2017 at 23:08
  • 2
    IMHO this question can be useful to have, along with an answer like @RichardHorrocks comment. If it gets closed, it might not be as searchable. But it's up to the community if it wants to close this.
    – eth
    Commented Jul 14, 2017 at 19:56
  • Happy to leave this open if people think it'll be useful. Commented Jul 14, 2017 at 21:19
  • See also: askubuntu.com/questions/8653/…
    – Lee
    Commented May 18, 2019 at 15:07

1 Answer 1

2

When you close your Putty session it delivers a hang-up signal (SIGHUP) to the Geth daemon, which causes it to close. The Putty session is Geth's parent process, regardless of using the --daemon option, so its children will die with it.

Note that I think some care has to be taken when Geth closes in this way. I don't think Geth has proper signal handlers for SIGHUP which could mean that things aren't left in a clean state. (e.g. If you're syncing block data, then corruption of the data is a possible outcome.)

See the accepted answer to this thread: Is it safe to kill geth with SIGTERM?

To prevent the daemon being killed in this way, you have a few options. The two that I've used in the past (for things unrelated to Ethereum) are either to redirect the SIGHUP so it isn't delivered to the process, or use a utility like screen (which I think is easier).

These threads (1, 2) from other Stack Exchange boards have more details.

1
  • 1
    congrats on 10k :) Commented Jul 14, 2017 at 22:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.