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:
But it didn't work.
How do I keep geth running?
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).