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?

closed as off-topic by Richard Horrocks, Ismael, Badr Bellaj, Tesa, Thomas Jay Rush Jul 15 '17 at 16:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Ethereum, the decentralized application platform and smart contract enabled blockchain, within the scope defined in the help center." – Richard Horrocks, Ismael, Badr Bellaj, Tesa, Thomas Jay Rush
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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. – Richard Horrocks Jul 12 '17 at 23:07
  • 2
    For example: superuser.com/questions/96660/… – Richard Horrocks Jul 12 '17 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 Jul 14 '17 at 19:56
  • Happy to leave this open if people think it'll be useful. – Richard Horrocks Jul 14 '17 at 21:19
  • See also: askubuntu.com/questions/8653/… – atomh33ls May 18 at 15:07
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.

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