Okay let try now the new version
integrating all the remarks.
The noticeable change are in bacula-dir.service
As systemd care about dependencies we comment the wants database
it's fully configured by the configure & make but we let that to the admin
responsability
(the database could be on another server)
the option --with-systemd now react correctly (default is off) can be yes and
try autoconfiguration
or yes,/path/to/service.files
I didn't join a new configure to let the patch really small
And hope that finally I get all it done.
Thanks Marco, & Eric
--
Bruno Friedmann
Ioda-Net Sàrl www.ioda-net.ch
openSUSE Member & Ambassador
GPG KEY : D5C9B751C4653227
irc: tigerfoot
>From f98ae3f0f1d611a41541fc4dc28739fa33fac715 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Mon, 10 Oct 2011 17:06:00 +0200
Subject: [PATCH 2/8] Makefile.in and service ready for systemd
Signed-off-by: Bruno Friedmann <br...@ioda-net.ch>
---
bacula/platforms/Makefile.in | 2 +-
bacula/platforms/systemd/Makefile.in | 97 ++++++++++++++++++++++++
bacula/platforms/systemd/bacula-dir.service.in | 32 ++++++++
bacula/platforms/systemd/bacula-fd.service.in | 30 +++++++
bacula/platforms/systemd/bacula-sd.service.in | 30 +++++++
5 files changed, 190 insertions(+), 1 deletions(-)
create mode 100644 bacula/platforms/systemd/Makefile.in
create mode 100644 bacula/platforms/systemd/bacula-dir.service.in
create mode 100644 bacula/platforms/systemd/bacula-fd.service.in
create mode 100644 bacula/platforms/systemd/bacula-sd.service.in
diff --git a/bacula/platforms/Makefile.in b/bacula/platforms/Makefile.in
index 79101b0..bba619b 100644
--- a/bacula/platforms/Makefile.in
+++ b/bacula/platforms/Makefile.in
@@ -12,7 +12,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL = @INSTALL@
SUBDIRS = freebsd redhat solaris unknown openbsd osx irix gentoo \
- debian darwin aix bsdi mandrake slackware alpha ubuntu
+ debian darwin aix bsdi mandrake slackware alpha ubuntu systemd
MAKE = make
diff --git a/bacula/platforms/systemd/Makefile.in b/bacula/platforms/systemd/Makefile.in
new file mode 100644
index 0000000..826c958
--- /dev/null
+++ b/bacula/platforms/systemd/Makefile.in
@@ -0,0 +1,97 @@
+#
+# This file is used as the template to create the
+# Makefile for the systemd specific installation.
+#
+#
+# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+# should be /lib/systemd/system and get be get with
+# systemctl show | grep UnitPath | cut -d " " -f2
+SYSTEMD_UNITDIR = @SYSTEMD_UNITDIR@
+
+nothing:
+
+install: install-autostart
+
+install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
+
+
+install-autostart-fd:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+ /bin/systemctl stop bacula-fd.service; \
+ /bin/systemctl disable bacula-fd.service; \
+ fi
+ @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
+ # set symlinks for script at startup and shutdown
+ @if test x$(DESTDIR) = x ; then \
+ /bin/systemctl enable bacula-fd.service; \
+ /bin/systemctl start bacula-fd.service; \
+ fi
+
+
+install-autostart-sd:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+ /bin/systemctl stop bacula-sd.service; \
+ /bin/systemctl disable bacula-sd.service; \
+ fi
+ @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
+ # set symlinks for script at startup and shutdown
+ @if test x$(DESTDIR) = x ; then \
+ /bin/systemctl enable bacula-sd.service; \
+ /bin/systemctl start bacula-sd.service; \
+ fi
+
+
+install-autostart-dir:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
+ /bin/systemctl stop bacula-dir.service; \
+ /bin/systemctl disable bacula-dir.service; \
+ fi
+ @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
+ # set symlinks for script at startup and shutdown
+ @if test x$(DESTDIR) = x ; then \
+ /bin/systemctl enable bacula-dir.service; \
+ /bin/systemctl start bacula-dir.service; \
+ fi
+
+
+uninstall: uninstall-autostart
+
+uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
+
+uninstall-autostart-fd:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+ /bin/systemctl stop bacula-fd.service; \
+ /bin/systemctl disable bacula-fd.service; \
+ fi
+ @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
+
+
+uninstall-autostart-sd:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+ /bin/systemctl stop bacula-fd.service; \
+ /bin/systemctl disable bacula-fd.service; \
+ fi
+ @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
+
+uninstall-autostart-dir:
+ @if test x$(DESTDIR) = x -a -f $(SYSTEMD)/bacula-dir.service; then \
+ /bin/systemctl stop bacula-dir.service; \
+ /bin/systemctl disable bacula-dir.service; \
+ fi
+ @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
+
+clean:
+ @rm -f 1 2 3
+
+distclean: clean
+ @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+ @rm -f bacula-sd.service bacula-fd.service bacula-dir.service
+
+devclean: clean
+ @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+ @rm -f bacula-sd.service bacula-fd.service bacula-dir.service
+
diff --git a/bacula/platforms/systemd/bacula-dir.service.in b/bacula/platforms/systemd/bacula-dir.service.in
new file mode 100644
index 0000000..a10488e
--- /dev/null
+++ b/bacula/platforms/systemd/bacula-dir.service.in
@@ -0,0 +1,32 @@
+# This file is part of package Bacula Director Daemon
+#
+# 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
+#
+# Bacula Director Daemon service
+#
+[Unit]
+Description=Bacula Director Daemon service
+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
+Wants=@DB_TYPE@.service
+# Before=
+# Conflicts=
+
+[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 @sysconfig@/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
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bacula/platforms/systemd/bacula-fd.service.in b/bacula/platforms/systemd/bacula-fd.service.in
new file mode 100644
index 0000000..7595768
--- /dev/null
+++ b/bacula/platforms/systemd/bacula-fd.service.in
@@ -0,0 +1,30 @@
+File daemon ( actually work well)
+# This file is part of package Bacula File Daemon
+#
+# Copyright (c) 2011 Free Software Foundation Europe e.V.
+# Bacula Community
+# Author: Bruno Friedmann
+# Description:
+# Used to start the bacula file daemon service (bacula-fd)
+# will be installed as /lib/systemd/system/bacula-fd.service
+# enable : systemctl enable bacula-fd.service
+# start : systemctl start bacula-fd.service
+#
+# Bacula File Daemon service
+#
+[Unit]
+Description=Bacula File Daemon service
+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
+# Wants=
+# Before=
+# Conflicts=
+
+[Service]
+Type=forking
+PIDFile=@piddir@/bacula-fd.pid
+StandardOutput=syslog
+ExecStart=@sbindir@/bacula-fd -u @fd_user@ -g @fd_group@ -c @sysconfig@/bacula-fd.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bacula/platforms/systemd/bacula-sd.service.in b/bacula/platforms/systemd/bacula-sd.service.in
new file mode 100644
index 0000000..4d542f9
--- /dev/null
+++ b/bacula/platforms/systemd/bacula-sd.service.in
@@ -0,0 +1,30 @@
+# This file is part of package Bacula Storage Daemon
+#
+# Copyright (c) 2011 Free Software Foundation Europe e.V.
+# for Bacula Community
+# Author: Bruno Friedmann
+# Description:
+# Used to start the bacula storage daemon service (bacula-sd)
+# will be installed as /lib/systemd/system/bacula-sd.service
+# enable : systemctl enable bacula-sd.service
+# start : systemctl start bacula-sd.service
+#
+# Bacula Storage Daemon service
+#
+[Unit]
+Description=Bacula Storage Daemon service
+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
+# Wants=
+# Before=
+# Conflicts=
+
+[Service]
+Type=forking
+PIDFile=@piddir@/bacula-sd.pid
+# EnvironmentFile=-/etc/sysconfig/bacula-sd
+StandardOutput=syslog
+ExecStart=@sbindir@/bacula-sd -u @sd_user@ -g @sd_group@ -c @sysconfig@/bacula-sd.conf
+
+[Install]
+WantedBy=multi-user.target
--
1.7.7.3
>From e147b9b138efdafad91c172b7d887f137ed9ecf8 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Wed, 12 Oct 2011 07:53:19 +0200
Subject: [PATCH 3/8] Fixed type in sysconfdir
Signed-off-by: Bruno Friedmann <br...@ioda-net.ch>
---
bacula/platforms/systemd/bacula-dir.service.in | 2 +-
bacula/platforms/systemd/bacula-fd.service.in | 2 +-
bacula/platforms/systemd/bacula-sd.service.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bacula/platforms/systemd/bacula-dir.service.in b/bacula/platforms/systemd/bacula-dir.service.in
index a10488e..7f18b84 100644
--- a/bacula/platforms/systemd/bacula-dir.service.in
+++ b/bacula/platforms/systemd/bacula-dir.service.in
@@ -24,7 +24,7 @@ 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 @sysconfig@/bacula-dir.conf
+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
diff --git a/bacula/platforms/systemd/bacula-fd.service.in b/bacula/platforms/systemd/bacula-fd.service.in
index 7595768..23169c5 100644
--- a/bacula/platforms/systemd/bacula-fd.service.in
+++ b/bacula/platforms/systemd/bacula-fd.service.in
@@ -24,7 +24,7 @@ After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.tar
Type=forking
PIDFile=@piddir@/bacula-fd.pid
StandardOutput=syslog
-ExecStart=@sbindir@/bacula-fd -u @fd_user@ -g @fd_group@ -c @sysconfig@/bacula-fd.conf
+ExecStart=@sbindir@/bacula-fd -u @fd_user@ -g @fd_group@ -c @sysconfdir@/bacula-fd.conf
[Install]
WantedBy=multi-user.target
diff --git a/bacula/platforms/systemd/bacula-sd.service.in b/bacula/platforms/systemd/bacula-sd.service.in
index 4d542f9..58687dc 100644
--- a/bacula/platforms/systemd/bacula-sd.service.in
+++ b/bacula/platforms/systemd/bacula-sd.service.in
@@ -24,7 +24,7 @@ Type=forking
PIDFile=@piddir@/bacula-sd.pid
# EnvironmentFile=-/etc/sysconfig/bacula-sd
StandardOutput=syslog
-ExecStart=@sbindir@/bacula-sd -u @sd_user@ -g @sd_group@ -c @sysconfig@/bacula-sd.conf
+ExecStart=@sbindir@/bacula-sd -u @sd_user@ -g @sd_group@ -c @sysconfdir@/bacula-sd.conf
[Install]
WantedBy=multi-user.target
--
1.7.7.3
>From e473eaee6f53e511d314c99b538bfff88df2cec7 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Sun, 13 Nov 2011 20:55:04 +0100
Subject: [PATCH 4/8] Change DEFAULT_DB_TYPE new type upstream
---
bacula/platforms/systemd/bacula-dir.service.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bacula/platforms/systemd/bacula-dir.service.in b/bacula/platforms/systemd/bacula-dir.service.in
index 7f18b84..3d2bf3b 100644
--- a/bacula/platforms/systemd/bacula-dir.service.in
+++ b/bacula/platforms/systemd/bacula-dir.service.in
@@ -15,7 +15,7 @@
Description=Bacula Director Daemon service
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
-Wants=@DB_TYPE@.service
+Wants=@DEFAULT_DB_TYPE@.service
# Before=
# Conflicts=
--
1.7.7.3
>From f24e7695294ae220ef79c81343be1109ceee0253 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Mon, 14 Nov 2011 08:09:14 +0100
Subject: [PATCH 5/8] Add Systemd configure options
---
bacula/autoconf/configure.in | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index 7980e73..7e36066 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -3125,6 +3125,27 @@ unknown)
;;
esac
+dnl -------------------------------------------
+dnl systemd (default off)
+dnl -------------------------------------------
+AC_ARG_WITH(systemd,
+ AC_HELP_STRING([--with-systemd@<:@=UNITDIR@:>@], [Include systemd support. UNITDIR is where systemd system .service files are located, default is to ask systemctl.]),
+ [
+ SYSTEMD_UNITDIR="`systemctl show | grep UnitPath | cut -d " " -f2`"
+ PFILES="${PFILES} \
+ platforms/systemd/Makefile \
+ platforms/systemd/bacula-dir.service \
+ platforms/systemd/bacula-fd.service \
+ platforms/systemd/bacula-sd.service"
+ AC_DEFINE([HAVE_SYSTEMD], 1)
+ AC_MSG_RESULT(yes)
+ support_systemd="yes"
+ ],[
+ AC_MSG_RESULT(no)
+ ]
+)
+AC_SUBST(SYSTEMD_UNITDIR)
+
AC_SUBST(hostname)
LIBS="$PTHREAD_LIB $LIBS"
@@ -3426,6 +3447,7 @@ Configuration on `date`:
ACL support: ${have_acl}
XATTR support: ${have_xattr}
Python support: ${support_python} ${PYTHON_LIBS}
+ systemd support: ${support_systemd} ${SYSTEMD_UNITDIR}
Batch insert enabled: ${batch_insert_db_backends}
" > config.out
--
1.7.7.3
>From 7a1c760848c199e69f855a2b7553ded0eb14d0bc Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Mon, 14 Nov 2011 13:05:19 +0100
Subject: [PATCH 6/8] Fix typo and support=no
---
bacula/autoconf/configure.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index 7e36066..20fa8e4 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -3141,7 +3141,8 @@ AC_ARG_WITH(systemd,
AC_MSG_RESULT(yes)
support_systemd="yes"
],[
- AC_MSG_RESULT(no)
+ support_systemd="no"
+ AC_MSG_RESULT(no)
]
)
AC_SUBST(SYSTEMD_UNITDIR)
--
1.7.7.3
>From 123d970e586b66f9df92b237d71e536b33479d76 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Sun, 20 Nov 2011 11:56:40 +0100
Subject: [PATCH 7/8] Added new way to enable systemd --with-systemd default
no support yes and path to systemd service files if
not the default
---
bacula/autoconf/configure.in | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index 20fa8e4..b83d109 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -3131,18 +3131,28 @@ dnl -------------------------------------------
AC_ARG_WITH(systemd,
AC_HELP_STRING([--with-systemd@<:@=UNITDIR@:>@], [Include systemd support. UNITDIR is where systemd system .service files are located, default is to ask systemctl.]),
[
- SYSTEMD_UNITDIR="`systemctl show | grep UnitPath | cut -d " " -f2`"
- PFILES="${PFILES} \
- platforms/systemd/Makefile \
- platforms/systemd/bacula-dir.service \
- platforms/systemd/bacula-fd.service \
- platforms/systemd/bacula-sd.service"
- AC_DEFINE([HAVE_SYSTEMD], 1)
- AC_MSG_RESULT(yes)
- support_systemd="yes"
+ if test "$withval" != "no"; then
+ if test "$withval" = "yes"; then
+ SYSTEMD_UNITDIR="`systemctl show | grep UnitPath | cut -d " " -f2`"
+ else
+ SYSTEMD_UNITDIR="${withval}"
+ fi
+
+ PFILES="${PFILES} \
+ platforms/systemd/Makefile \
+ platforms/systemd/bacula-dir.service \
+ platforms/systemd/bacula-fd.service \
+ platforms/systemd/bacula-sd.service"
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd support should be enabled])
+ AC_MSG_RESULT(yes)
+ support_systemd="yes"
+ else
+ AC_MSG_RESULT(no)
+ support_systemd="no"
+ fi
],[
- support_systemd="no"
- AC_MSG_RESULT(no)
+ support_systemd="no"
+ AC_MSG_RESULT(no)
]
)
AC_SUBST(SYSTEMD_UNITDIR)
--
1.7.7.3
>From a7ffaa1c4460b5d7f01e033fd42dd4091514e038 Mon Sep 17 00:00:00 2001
From: Bruno Friedmann <br...@ioda-net.ch>
Date: Sun, 20 Nov 2011 11:58:10 +0100
Subject: [PATCH 8/8] Commented out the dep on the database We can't make
assumption on where or what database will be used So we
let that to the admin decision
---
bacula/platforms/systemd/bacula-dir.service.in | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/bacula/platforms/systemd/bacula-dir.service.in b/bacula/platforms/systemd/bacula-dir.service.in
index 3d2bf3b..5c928c1 100644
--- a/bacula/platforms/systemd/bacula-dir.service.in
+++ b/bacula/platforms/systemd/bacula-dir.service.in
@@ -13,9 +13,14 @@
#
[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
-Wants=@DEFAULT_DB_TYPE@.service
+# 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=
--
1.7.7.3
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel