[pkg-bacula-commits] [bacula] 03/04: Change bacula-{sd, fd, director}.services to non-forking simple mode
Sven Hartge
hartge-guest at moszumanska.debian.org
Tue Jul 12 19:47:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
hartge-guest pushed a commit to branch master-systemd
in repository bacula.
commit 825114c29b3a6448b50099fdfe581cdc37fb5325
Author: Sven Hartge <sven at svenhartge.de>
Date: Tue Jul 12 21:28:35 2016 +0200
Change bacula-{sd,fd,director}.services to non-forking simple mode
- Rewrite the provided services units to be of Type=simple
Start daemons with "-f" to avoid double-forking and let systemd retain
full control over them.
- Prime the environment to sane values and then read user specified
values from /etc/default/bacula-{sd,fd,director}.
- Add the value "15" to the SuccessExitStatus. This is needed because
the daemons return the numerical value of the signal used to terminate
them as exit code. Adding 15/SIGTERM to SuccessExitStatus avoids a
harmless failure state of the service after normally stopping it.
- Use ExecStartPre to check the config files before starting the
daemons. (This one needs some more checking, as I cannot get the check
to fail even if I provide a broken config file.)
---
debian/patches/non-forking-systemd-units.patch | 74 ++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 75 insertions(+)
diff --git a/debian/patches/non-forking-systemd-units.patch b/debian/patches/non-forking-systemd-units.patch
new file mode 100644
index 0000000..fb873c1
--- /dev/null
+++ b/debian/patches/non-forking-systemd-units.patch
@@ -0,0 +1,74 @@
+Description: Change systemd.units to non-forking simple mode
+Author: Sven Hartge <sven at svenhartge.de>
+
+Index: bacula-7.4.2+dfsg/platforms/systemd/bacula-dir.service.in
+===================================================================
+--- bacula-7.4.2+dfsg.orig/platforms/systemd/bacula-dir.service.in
++++ bacula-7.4.2+dfsg/platforms/systemd/bacula-dir.service.in
+@@ -22,13 +22,14 @@ RequiresMountsFor=@working_dir@ @sysconf
+
+ # From http://www.freedesktop.org/software/systemd/man/systemd.service.html
+ [Service]
+-Type=forking
+-User=@dir_user@
+-Group=@dir_group@
+-ExecStart=@sbindir@/bacula-dir -c @sysconfdir@/bacula-dir.conf
+-PIDFile=@piddir@/bacula-dir. at dir_port@.pid
+-ExecReload=@sbindir@/bacula-dir -t -c @sysconfdir@/bacula-dir.conf
++Type=simple
++Environment="CONFIG=/etc/bacula/bacula-dir.conf" "ARGS=-u bacula -g bacula"
++EnvironmentFile=-/etc/default/bacula-dir
++ExecStartPre=@sbindir@/bacula-dir -t -c $CONFIG $ARGS
++ExecStart=@sbindir@/bacula-dir -f -c $CONFIG $ARGS
++ExecReload=@sbindir@/bacula-dir -t -c $CONFIG $ARGS
+ ExecReload=/bin/kill -HUP $MAINPID
++SuccessExitStatus=15
+ StandardError=syslog
+
+ [Install]
+Index: bacula-7.4.2+dfsg/platforms/systemd/bacula-fd.service.in
+===================================================================
+--- bacula-7.4.2+dfsg.orig/platforms/systemd/bacula-fd.service.in
++++ bacula-7.4.2+dfsg/platforms/systemd/bacula-fd.service.in
+@@ -22,11 +22,13 @@ RequiresMountsFor=@working_dir@ @sysconf
+
+ # from http://www.freedesktop.org/software/systemd/man/systemd.service.html
+ [Service]
+-Type=forking
+-User=@fd_user@
+-Group=@fd_group@
+-ExecStart=@sbindir@/bacula-fd -c @sysconfdir@/bacula-fd.conf
+-PIDFile=@piddir@/bacula-fd. at fd_port@.pid
++Type=simple
++Environment="CONFIG=/etc/bacula/bacula-fd.conf" "ARGS=-u root -g root"
++EnvironmentFile=-/etc/default/bacula-fd
++ExecStartPre=@sbindir@/bacula-fd -t -c $CONFIG $ARGS
++ExecStart=@sbindir@/bacula-fd -f -c $CONFIG $ARGS
++ExecReload=/bin/kill -HUP $MAINPID
++SuccessExitStatus=15
+ StandardError=syslog
+
+ [Install]
+Index: bacula-7.4.2+dfsg/platforms/systemd/bacula-sd.service.in
+===================================================================
+--- bacula-7.4.2+dfsg.orig/platforms/systemd/bacula-sd.service.in
++++ bacula-7.4.2+dfsg/platforms/systemd/bacula-sd.service.in
+@@ -21,11 +21,13 @@ RequiresMountsFor=@working_dir@ @sysconf
+
+ # from http://www.freedesktop.org/software/systemd/man/systemd.service.html
+ [Service]
+-Type=forking
+-User=@sd_user@
+-Group=@sd_group@
+-ExecStart=@sbindir@/bacula-sd -c @sysconfdir@/bacula-sd.conf
+-PIDFile=@piddir@/bacula-sd. at sd_port@.pid
++Type=simple
++Environment="CONFIG=/etc/bacula/bacula-sd.conf" "ARGS=-u bacula -g tape"
++EnvironmentFile=-/etc/default/bacula-sd
++ExecStartPre=@sbindir@/bacula-sd -t -c $CONFIG $ARGS
++ExecStart=@sbindir@/bacula-sd -f -c $CONFIG $ARGS
++ExecReload=/bin/kill -HUP $MAINPID
++SuccessExitStatus=15
+ StandardError=syslog
+
+ [Install]
diff --git a/debian/patches/series b/debian/patches/series
index fda1104..a58866a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ remove-upstream-autoconf-log.patch
fix-libbaccats-rpath.patch
fix-scriptdir-examples-devices.patch
enable-hardening-for-bat.patch
+non-forking-systemd-units.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git
More information about the pkg-bacula-commits
mailing list