1

Hi all,

I am running a couple of private nodes on AWS, and I am trying to get Geth to start on system start up.

I found this post --> Is there the start/stop script of geth after Debian/Ubuntu booting?

and followed it, trying the following in the geth@.service file

<P>[Unit]<BR>
Description=Start geth<BR>
Requires=network.target<BR>
[Service]<BR>
Type=forking<BR>
User=%I<BR>
ExecStart=/bin/sh -c "/usr/bin/geth --networkid 1900 --nodiscover --verbosity 4 init /home/ubuntu/.ethereum/InitGenesis.json"<BR>
Restart=on-failure<BR>
[Install]<BR>
WantedBy=multi-user.target<BR>
</P><P>

However I cannot get Geth to start.

systemctl status geth@ubuntu outputs:

<p>● geth@ubuntu.service - Start geth<BR>
   Loaded: loaded (/etc/systemd/system/geth@.service; disabled; vendor preset: enabled)<BR>
   Active: inactive (dead)<P>

I am not sure what I am doing wrong. Can anyone point me in the right direction?

1

The way Geth currently works it's weird to be passing it init as an argument for when you routinely stop and start it. You run it once with init, also specifying your genesis.json file and the appropriate datadir, and that sets up the appropriate chain under the datadir. When you run it after that you just have to specify datadir. (You can omit datadir too if you're using mainnet or testnet, as it will use its default directories.)

Without using the systemd script, run it with init first, then confirm that you can start and stop manually. Also make sure you have the right rpc/ipc options that will allow you to connect to it in whatever way you intend to connect to it. Once that's working, stop it, copy your start command into the systemd script and start it with systemctl.

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.