diff --git a/.res/systemd/diun.service b/.res/systemd/diun.service new file mode 100644 index 00000000..ba2ce978 --- /dev/null +++ b/.res/systemd/diun.service @@ -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 diff --git a/doc/install/linux-service.md b/doc/install/linux-service.md new file mode 100644 index 00000000..a1ef213a --- /dev/null +++ b/doc/install/linux-service.md @@ -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 +```