[pkg-bacula-commits] [bacula] 01/03: Do not create PID files when running in foreground
Sven Hartge
hartge-guest at moszumanska.debian.org
Fri Oct 27 20:25:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
hartge-guest pushed a commit to branch no-foreground-pidfile
in repository bacula.
commit 0474f5e314c3b43543a0a715d1252de786773936
Author: Sven Hartge <sven at svenhartge.de>
Date: Fri Oct 27 20:04:04 2017 +0200
Do not create PID files when running in foreground
---
debian/patches/no-pid-when-foreground.path | 89 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 90 insertions(+)
diff --git a/debian/patches/no-pid-when-foreground.path b/debian/patches/no-pid-when-foreground.path
new file mode 100644
index 0000000..96e8aaa
--- /dev/null
+++ b/debian/patches/no-pid-when-foreground.path
@@ -0,0 +1,89 @@
+diff --git a/src/dird/dird.c b/src/dird/dird.c
+index 9bde2ebb..a5e4ed47 100644
+--- a/src/dird/dird.c
++++ b/src/dird/dird.c
+@@ -311,8 +311,10 @@ int main (int argc, char *argv[])
+
+ if (!test_config) {
+ /* Create pid must come after we are a daemon -- so we have our final pid */
+- create_pid_file(director->pid_directory, "bacula-dir",
+- get_first_port_host_order(director->DIRaddrs));
++ if (!foreground) {
++ create_pid_file(director->pid_directory, "bacula-dir",
++ get_first_port_host_order(director->DIRaddrs));
++ }
+ read_state_file(director->working_directory, "bacula-dir",
+ get_first_port_host_order(director->DIRaddrs));
+ }
+@@ -677,7 +679,9 @@ void terminate_dird(int sig)
+ unload_plugins();
+ if (!test_config) {
+ write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+- delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
++ if (!foreground) {
++ delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
++ }
+ }
+ term_scheduler();
+ term_job_server();
+diff --git a/src/filed/filed.c b/src/filed/filed.c
+index 28b2baff..bf3bf294 100644
+--- a/src/filed/filed.c
++++ b/src/filed/filed.c
+@@ -233,8 +233,10 @@ int main (int argc, char *argv[])
+ lmgr_init_thread(); /* initialize the lockmanager stack */
+
+ /* Maximum 1 daemon at a time */
+- create_pid_file(me->pid_directory, PROG_NAME,
+- get_first_port_host_order(me->FDaddrs));
++ if (!foreground) {
++ create_pid_file(me->pid_directory, PROG_NAME,
++ get_first_port_host_order(me->FDaddrs));
++ }
+ read_state_file(me->working_directory, PROG_NAME,
+ get_first_port_host_order(me->FDaddrs));
+
+@@ -293,8 +295,10 @@ void terminate_filed(int sig)
+ if (!test_config) {
+ write_state_file(me->working_directory,
+ "bacula-fd", get_first_port_host_order(me->FDaddrs));
+- delete_pid_file(me->pid_directory,
+- "bacula-fd", get_first_port_host_order(me->FDaddrs));
++ if (!foreground) {
++ delete_pid_file(me->pid_directory,
++ "bacula-fd", get_first_port_host_order(me->FDaddrs));
++ }
+ }
+
+ if (configfile != NULL) {
+diff --git a/src/stored/stored.c b/src/stored/stored.c
+index 5886433d..d347164d 100644
+--- a/src/stored/stored.c
++++ b/src/stored/stored.c
+@@ -276,9 +276,10 @@ int main (int argc, char *argv[])
+
+ my_name_is(0, (char **)NULL, me->hdr.name); /* Set our real name */
+
+-
+- create_pid_file(me->pid_directory, "bacula-sd",
+- get_first_port_host_order(me->sdaddrs));
++ if (!foreground) {
++ create_pid_file(me->pid_directory, "bacula-sd",
++ get_first_port_host_order(me->sdaddrs));
++ }
+ read_state_file(me->working_directory, "bacula-sd",
+ get_first_port_host_order(me->sdaddrs));
+
+@@ -747,8 +748,10 @@ void terminate_stored(int sig)
+ if (!test_config) {
+ write_state_file(me->working_directory,
+ "bacula-sd", get_first_port_host_order(me->sdaddrs));
+- delete_pid_file(me->pid_directory,
+- "bacula-sd", get_first_port_host_order(me->sdaddrs));
++ if (!foreground) {
++ delete_pid_file(me->pid_directory,
++ "bacula-sd", get_first_port_host_order(me->sdaddrs));
++ }
+ }
+
+ Dmsg1(200, "In terminate_stored() sig=%d\n", sig);
diff --git a/debian/patches/series b/debian/patches/series
index ec9b645..1e0cc47 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ non-forking-systemd-units.patch
#upstream-fix-baculabackupreport-defaults.patch
#debian-fix-baculabackupreport-defaults.patch
upstream-fix-update_sqlite3_tables.patch
+no-pid-when-foreground.path
--
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