add systemd service and socket files

This commit is contained in:
Gabx 2016-05-03 19:22:04 +02:00
parent 9e323d65b2
commit 32934f360f
3 changed files with 44 additions and 0 deletions

View file

@ -50,6 +50,31 @@ Go Ethereum comes with several wrappers/executables found in
`disasm` | disassembles EVM code: `echo "6001" | disasm` | `disasm` | disassembles EVM code: `echo "6001" | disasm` |
`rlpdump` | prints RLP structures | `rlpdump` | prints RLP structures |
## Start geth with systemd
Start the get daemon with systemd presents many advantages:
- service will run in the background and thus will not monopolize one shell
- service will run as user and not root
- logs will be managed by [_journalctl_](https://www.freedesktop.org/software/systemd/man/journalctl.html)
- the ```get.ipc``` socket can be created in ```/run/user/userID``` volatile directory.
### Install
* place the ```geth.service``` and ```get.socket``` files in ```/etc/systemd/user```.
* create and edit the ```~/.ethereum/get.conf``` file according to the desired options
* enable and start the service:
```
$ systemctl --user enable get.service
$ systemctl --user start get.service
```
* verify it is correctly started and running:
```
$ systemctl --user status geth.service
```
## Command line options ## Command line options
`geth` can be configured via command line options, environment variables and config files. `geth` can be configured via command line options, environment variables and config files.

12
geth.service Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=Geth Daemon
Requires=geth.socket
[Service]
EnvironmentFile=%h/.ethereum/geth.conf
ExecStart=/usr/bin/geth $ARGS
[Install]
WantedBy=default.target

7
geth.socket Normal file
View file

@ -0,0 +1,7 @@
[Unit]
Description=geth daemon (socket activation)
[Socket]
ListenStream=%t/geth.ipc