]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/systemd/bacula-dir.service.in
Fix #2806 about the director service started before the database with systemd
[bacula/bacula] / bacula / platforms / systemd / bacula-dir.service.in
index 5c928c13159474706e8fde2d797a0d9ebb3fd103..8fc3cfea364ee460cac9d35b5ed36d5ad9da59c6 100644 (file)
@@ -1,37 +1,35 @@
-# This file is part of package Bacula Director Daemon
+# Systemd Bacula service file
+#
+# Copyright (C) 2000-2016 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# /lib/systemd/system/bacula-dir.service
 #
-# Copyright (c) 2011 Free Software Foundation Europe e.V.
-# Bacula Community
-# Author: Bruno Friedmann
 # Description:
-#    Used to start the bacula director daemon service (bacula-dir)
-#     will be installed as /lib/systemd/system/bacula-dir.service
-#    enable : systemctl enable bacula-dir.service
-#       start : systemctl start bacula-dir.service
+#    Used to start/stop/reload the bacula director daemon service (bacula-dir)
 #
-# Bacula Director Daemon service
+#    enable : systemctl enable bacula-dir
+#    start : systemctl start bacula-dir
 #
+#
+
+# From http://www.freedesktop.org/software/systemd/man/systemd.unit.html
 [Unit]
 Description=Bacula Director Daemon service
-Alias=bacula-dir
-Requires=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
-# Dependency about the database
-# We let administrators decide if they need it (if local db instance)
-# Wants=@DEFAULT_DB_TYPE@.service
-# Check if working dir exist and is a directory
-ConditionPathIsDirectory=@working_dir@
-# Before=
-# Conflicts=
+Requires=network.target
+After=network.target multi-user.target
+RequiresMountsFor=@working_dir@ @sysconfdir@ @sbindir@ @piddir@
 
+# From http://www.freedesktop.org/software/systemd/man/systemd.service.html
 [Service]
 Type=forking
-PIDFile=@piddir@/bacula-dir.pid
-# EnvironmentFile=-/etc/sysconfig/bacula-dir
-StandardOutput=syslog
-ExecStart=@sbindir@/bacula-dir -u @dir_user@ -g @dir_group@ -c @sysconfdir@/bacula-dir.conf
-# This daemon should be able to reload the conf file
-#ExecReload=/sbin/killproc -p @piddir@/bacula-dir.pid -HUP @sbindir@/bacula-dir
+User=@dir_user@
+Group=@dir_group@
+ExecStart=@sbindir@/bacula-dir -c @sysconfdir@/bacula-dir.conf
+PIDFile=@piddir@/bacula-dir.@dir_port@.pid
+ExecReload=@sbindir@/bacula-dir -t -c @sysconfdir@/bacula-dir.conf
+ExecReload=/bin/kill -HUP $MAINPID
+StandardError=syslog
 
 [Install]
 WantedBy=multi-user.target