From 64e64e6b03af48899d73098eb7de78a53e28386a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 4 Jun 2020 14:37:46 +0200 Subject: [PATCH] Set restart policies --- templates/grafana-server.service.j2 | 6 ++++++ templates/haproxy.service.j2 | 2 +- templates/hitch.service.j2 | 6 ++++++ templates/influxdb.service.j2 | 2 +- templates/telegraf.service.j2 | 6 ++++++ templates/transmission-daemon.service.j2 | 2 +- templates/varnish.service.j2 | 7 +++++++ 7 files changed, 28 insertions(+), 3 deletions(-) diff --git a/templates/grafana-server.service.j2 b/templates/grafana-server.service.j2 index ec3ae18..cfc2155 100644 --- a/templates/grafana-server.service.j2 +++ b/templates/grafana-server.service.j2 @@ -1,8 +1,14 @@ +[Unit] +StartLimitIntervalSec=0 + [Service] ExecStart= ExecStart=/usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/tmp/data cfg:default.paths.plugins=/tmp/plugins cfg:default.paths.provisioning=/tmp/provision # TODO: Store or provision a set of plugins, prefferably the latter +Restart=on-failure +RestartSec=10 + ProtectSystem=strict PrivateUsers=true NoNewPrivileges=yes diff --git a/templates/haproxy.service.j2 b/templates/haproxy.service.j2 index 96d9467..3d76d76 100644 --- a/templates/haproxy.service.j2 +++ b/templates/haproxy.service.j2 @@ -5,7 +5,7 @@ StartLimitIntervalSec=0 User=varnish Group=varnish -Restart=always +Restart=on-failure RestartSec=10 Environment= diff --git a/templates/hitch.service.j2 b/templates/hitch.service.j2 index 82db5d1..56c9275 100644 --- a/templates/hitch.service.j2 +++ b/templates/hitch.service.j2 @@ -1,3 +1,9 @@ +[Unit] +StartLimitIntervalSec=0 + [Service] ExecStart= ExecStart=/usr/sbin/hitch --user {{ hitch.user }} --group {{ hitch.group }} --config /etc/hitch/hitch.conf -L 2 --backend="{{ hitch.backend.sock }}" --frontend="[*]:{{ hitch.frontend.port }}" + +Restart=on-failure +RestartSec=10 diff --git a/templates/influxdb.service.j2 b/templates/influxdb.service.j2 index 50a0581..0da39ae 100644 --- a/templates/influxdb.service.j2 +++ b/templates/influxdb.service.j2 @@ -2,7 +2,7 @@ StartLimitIntervalSec=0 [Service] -Restart=always +Restart=on-failure RestartSec=10 # TODO: Add mounts diff --git a/templates/telegraf.service.j2 b/templates/telegraf.service.j2 index 05c12fe..d5f0300 100644 --- a/templates/telegraf.service.j2 +++ b/templates/telegraf.service.j2 @@ -1,8 +1,14 @@ +[Unit] +StartLimitIntervalSec=0 + [Service] EnvironmentFile= ExecStart= ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d +Restart=on-failure +RestartSec=10 + ProtectSystem=strict NoNewPrivileges=yes TemporaryFileSystem=/:ro diff --git a/templates/transmission-daemon.service.j2 b/templates/transmission-daemon.service.j2 index f98cc00..b02cd21 100644 --- a/templates/transmission-daemon.service.j2 +++ b/templates/transmission-daemon.service.j2 @@ -5,7 +5,7 @@ StartLimitIntervalSec=0 User=root DynamicUser=true -Restart=always +Restart=on-failure RestartSec=10 ProtectSystem=strict diff --git a/templates/varnish.service.j2 b/templates/varnish.service.j2 index 57fac2c..eb79b0e 100644 --- a/templates/varnish.service.j2 +++ b/templates/varnish.service.j2 @@ -1,3 +1,10 @@ +[Unit] +StartLimitIntervalSec=0 + [Service] + +Restart=on-failure +RestartSec=10 + ExecStart= ExecStart=/usr/sbin/varnishd -F -a {{ varnish.frontend.sock }},user={{ varnish.frontend.user }},group={{ varnish.frontend.group }},mode={{ varnish.frontend.mode }} -j unix,user={{ varnish.jail.user }} -f /etc/varnish/default.vcl -s malloc,256m