Skip to content

Commit

Permalink
Cleanup systemd files
Browse files Browse the repository at this point in the history
- 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

Fixes #240: Improve systemd service files
  • Loading branch information
tigerfoot authored and Marco van Wieringen committed Feb 17, 2015
1 parent d9efaf4 commit 7a7e4f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platforms/systemd/bareos-dir.service.in
Expand Up @@ -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
Expand All @@ -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
3 changes: 3 additions & 0 deletions platforms/systemd/bareos-fd.service.in
Expand Up @@ -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=
Expand All @@ -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
2 changes: 2 additions & 0 deletions platforms/systemd/bareos-sd.service.in
Expand Up @@ -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=
Expand All @@ -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

0 comments on commit 7a7e4f3

Please sign in to comment.