# This unit is inspired from
# `AdGuardHome -s install` on systemd machine and
# https://aur.archlinux.org/cgit/aur.git/tree/adguardhome.service?h=adguardhome

[Unit]
Description=Network-wide ads & trackers blocking DNS server with WebUI
After=syslog.target network-online.target
ConditionFileIsExecutable=/usr/bin/AdGuardHome

[Service]
StartLimitInterval=5
StartLimitBurst=10
DynamicUser=true
StateDirectory=AdGuardHome
WorkingDirectory=/var/lib/AdGuardHome
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW
ExecStart=/usr/bin/AdGuardHome --no-check-update --work-dir /var/lib/AdGuardHome -s run -v
ExecReload=/usr/bin/AdGuardHome -s reload
StandardOutput=journal
StandardError=journal
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
