30 lines
859 B
SYSTEMD
30 lines
859 B
SYSTEMD
|
# Pre-req
|
||
|
# sudo adduser watchdog --home /opt/watchdog
|
||
|
# sudo mkdir -p /opt/watchdog/ /var/log/watchdog
|
||
|
# sudo chown -R watchdog:watchdog /opt/watchdog/ /var/log/watchdog
|
||
|
|
||
|
[Unit]
|
||
|
Description=Watchdog - Get notified when sites go down
|
||
|
Documentation=https://git.rootprojects.org/root/watchdog.go
|
||
|
After=network-online.target
|
||
|
Wants=network-online.target systemd-networkd-wait-online.service
|
||
|
|
||
|
[Service]
|
||
|
# Restart on crash (bad signal), but not on 'clean' failure (error exit code)
|
||
|
# Allow up to 3 restarts within 10 seconds
|
||
|
# (it's unlikely that a user or properly-running script will do this)
|
||
|
Restart=on-abnormal
|
||
|
StartLimitInterval=10
|
||
|
StartLimitBurst=3
|
||
|
|
||
|
# User and group the process will run as
|
||
|
User=root
|
||
|
Group=root
|
||
|
|
||
|
WorkingDirectory=/opt/watchdog
|
||
|
ExecStart=/opt/watchdog -c ./config.json
|
||
|
ExecReload=/bin/kill -USR1 $MAINPID
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|