From 0b8c667b66262cb74a02a393db89eb6925ffe670 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <bruno@ioda-net.ch>
Date: Fri, 25 Oct 2013 09:08:40 +0200
Subject: [PATCH] Fixes #240: Improve systemd service files

Added documentation lines for each service
Added Restart on-failure for each service
Remove Alias from -dir (only for .target unit)
Added soft dependency for postgresql & mysql for bareos-dir in
After= line so systemd know we prefer to start once the db is up
---
 platforms/systemd/bareos-dir.service.in | 5 +++--
 platforms/systemd/bareos-fd.service.in  | 3 +++
 platforms/systemd/bareos-sd.service.in  | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/platforms/systemd/bareos-dir.service.in b/platforms/systemd/bareos-dir.service.in
index 8b9db74..fab5500 100644
--- a/platforms/systemd/bareos-dir.service.in
+++ b/platforms/systemd/bareos-dir.service.in
@@ -13,9 +13,9 @@
 #
 [Unit]
 Description=Bareos Director Daemon service
-Alias=bareos-dir
+Documentation=man:bareos-dir(8)
 Requires=nss-lookup.target network.target remote-fs.target time-sync.target
-After=nss-lookup.target network.target remote-fs.target time-sync.target
+After=nss-lookup.target network.target remote-fs.target time-sync.target postgresql.service mysql.service
 # Dependency about the database
 # We let administrators decide if they need it (if local db instance)
 # Wants=@DEFAULT_DB_TYPE@.service
@@ -35,6 +35,7 @@ StandardOutput=syslog
 ExecStart=@sbindir@/bareos-dir -c @sysconfdir@/bareos-dir.conf
 # This daemon should be able to reload the conf file
 #ExecReload=/sbin/killproc -p @piddir@/bareos-dir.pid -HUP @sbindir@/bareos-dir
+Restart=on-failure
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bareos-fd.service.in b/platforms/systemd/bareos-fd.service.in
index 4626635..2d046ea 100644
--- a/platforms/systemd/bareos-fd.service.in
+++ b/platforms/systemd/bareos-fd.service.in
@@ -13,6 +13,7 @@
 #
 [Unit]
 Description=Bareos File Daemon service
+Documentation=man:bareos-fd(8)
 Requires=nss-lookup.target network.target remote-fs.target time-sync.target
 After=nss-lookup.target network.target remote-fs.target time-sync.target
 # Wants=
@@ -27,6 +28,8 @@ WorkingDirectory=@working_dir@
 PIDFile=@piddir@/bareos-fd.@fd_port@.pid
 StandardOutput=syslog
 ExecStart=@sbindir@/bareos-fd -c @sysconfdir@/bareos-fd.conf
+Restart=on-failure
+# IOSchedulingClass=idle
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bareos-sd.service.in b/platforms/systemd/bareos-sd.service.in
index 85d09a8..740f6c7 100644
--- a/platforms/systemd/bareos-sd.service.in
+++ b/platforms/systemd/bareos-sd.service.in
@@ -13,6 +13,7 @@
 #
 [Unit]
 Description=Bareos Storage Daemon service
+Documentation=man:bareos-sd(8)
 Requires=nss-lookup.target network.target remote-fs.target time-sync.target
 After=nss-lookup.target network.target remote-fs.target time-sync.target
 # Wants=
@@ -28,6 +29,7 @@ PIDFile=@piddir@/bareos-sd.@sd_port@.pid
 # EnvironmentFile=-/etc/sysconfig/bareos-sd
 StandardOutput=syslog
 ExecStart=@sbindir@/bareos-sd -c @sysconfdir@/bareos-sd.conf
+Restart=on-failure
 
 [Install]
 WantedBy=multi-user.target
-- 
1.8.1.4

