Drake Evans

Create a .service file at /etc/systemd/system/gethNode.service

sudo nano /etc/systemd/system/gethNode.service

File contents:

[Unit]
Description=Geth Node running with persistant data in docker container. Port 30303 is mapped.
[Service]
Type=simple
ExecStart=/usr/bin/docker run -p 30303:30303 -v /mnt/gethData:/root/.ethereum ethereum/client-go
[Install]
WantedBy=multi-user.target

ExecStart expects a file path with args. File path can be /bin/bash if you want to pass in a bash script

Set correct permissions for this file

sudo chmod 644 /etc/systemd/system/gethNode.service

chmod reminder: 4=read, 2=write, 1=execute. Order is owner, group, others

Alternate command

sudo chmod o=rw,g=r,o=r /etc/systemd/system/gethNode.service

Restart the daemon (not required unless making changes to a .service file after is has been loaded)

sudo systemctl daemon-reload

Start the service

sudo systemctl <command> <fileNameNoExtension>
sudo systemctl start gethNode

Check the status is ok

sudo systemctl status gethNode

Enable the service on startup

sudo systemctl enable gethNode

--

--

Drake Evans

Drake Evans

A smart man can rationalize anything; set rules and don't break them. Biomedical Engineering, Computer Science, Finance, Economics.