Add Linux service doc and sample

This commit is contained in:
CrazyMax
2019-08-22 21:22:38 +02:00
parent 3ec7e934c8
commit 57dee4fa89
2 changed files with 45 additions and 0 deletions

17
.res/systemd/diun.service Normal file
View File

@@ -0,0 +1,17 @@
[Unit]
Description=Diun
Documentation=https://github.com/crazy-max/diun
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=diun
Group=diun
ExecStart=/usr/local/bin/diun --config /etc/diun/diun.yml --log-level info
Restart=always
Environment=DIUN_DB=/var/lib/diun/diun.db
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,28 @@
# Run as service on Debian based distro
## Using systemd
> :warning: Make sure to follow the instructions to [install from binary](binary.md) before.
Run the below command in a terminal:
```
sudo vim /etc/systemd/system/diun.service
```
Copy the sample [diun.service](../../.res/systemd/diun.service).
Change the user, group, and other required startup values following your needs.
Enable and start Diun at boot:
```
sudo systemctl enable diun
sudo systemctl start diun
```
To view logs:
```
journalctl -fu diun.service
```