> For the complete documentation index, see [llms.txt](https://docs.chaintools.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chaintools.tech/home/tooling-guides/systemd-service-template.md).

# Systemd Service Template

### Service template with logging to file

```bash
[Unit]
Description=Service
After=network-online.target

[Service]
Type=simple
User=<USER>
Group=<GROUP>
ExecStart=/home/<USER>/.local/bin/<SERVICE>
LimitNOFILE=8192
Restart=on-failure
RestartSec=3
StandardOutput=append:/home/<USER>/.logs/output.log
StandardError=append:/home/<USER>/.logs/error.log

[Install]
WantedBy=multi-user.target
```

### Service template with logging to journal

```bash
[Unit]
Description=Service
After=network-online.target

[Service]
Type=simple
User=<USER>
Group=<GROUP>
ExecStart=/home/<USER>/.local/bin/<SERVICE>
LimitNOFILE=8192
Restart=on-failure
RestartSec=3
StandardOutput=journal
StandardError=journal
SyslogIdentifier=<SERVICE_NAME>

[Install]
WantedBy=multi-user.target
```
