The requirement is keep a geth node synchronised almost always for a DAPP . The geth node is running on a ubuntu machine. The command being used to expose the geth rpc server is

geth --testnet --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3 --rpcport 8545 --rpccorsdomain "*" --rpcaddr "" --rpc

I usually connect to the server using putty . But when I close the putty session , the geth process also gets killed .I need to avoid this. What is required is to keep the geth syncing continuously , so that any user who uses the DAPP can make a transaction anytime.


First thing is to make sure you started the process in fast mode so the chain is always up to date. You can use geth's --fast command for quickest possible syncs.

Also, increase cache size to --cache=1024 instead of the default 128

To keep the process running after your putty logout, you can obviously try screen or use tmux which is a superior way of doing this.

  • I have already used tmux to achieve this successfully . Thanks for your response. – Webdev May 8 at 6:01

Setting up geth as a service - https://github.com/bas-vk/config/blob/master/geth-systemd-service.md

Create a file geth.service:

Description=Ethereum go client

ExecStart=geth 2>%h/.ethereum/geth.log


Enable service

$ systemctl --user enable geth.service
$ systemctl --user start geth.service
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Ismael May 7 at 17:22
  • Changed. Thanks for the feedback. – eth7 May 7 at 18:24

When you close SSH session, all processes you've run, either in background or foreground, receive SIGHUP (SIGnal Hang UP). Most applications, including geth, react to this signal by gracefully terminating themselves.

There are several ways how you may prevent your applications from terminating on SSH session close:

  1. Prevent them from receiving SIGHUP via nohup utility: nohup geth <your geth options here> &. Note this & at the end, it sends the process into background.
  2. Run geth inside virtual screen terminal that will stay alive after SSH session close. To do so, run screen then run your geth inside, then press Ctrl+A then press 'D' to detach your SSH session from virtual screen. Then close SSH session.

Though, if your want your geth not only to survive SSH session close, but also to automatically restart after system reboot, you need to configure it as a system service:

  1. Create file /etc/systemd/system/geth.service with the following content:
Description=Go Ethereum (geth)

ExecStart=geth <your geth options here>

  1. Execute command systemctl daemon-reload to load geth service
  2. Execute command systemctl enable geth.service to enable geth service
  3. Execute command systemctl start geth.service to start geth service

You will probably need superuser privileges to do all these steps.


Try screen. Set it up, start your node and detach (don't exit). When you log out from putty, your node should still be running

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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