From 95569bd8c04654013e2216b4fe1f99bae58c622e Mon Sep 17 00:00:00 2001 From: jpzhang187 Date: Mon, 8 Mar 2021 15:29:47 +0800 Subject: [PATCH] Stop the service and the process exits normally --- ...rvice-and-the-process-exits-normally.patch | 23 +++++++++++++++++++ bacula.spec | 7 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 bacula-stop-the-service-and-the-process-exits-normally.patch diff --git a/bacula-stop-the-service-and-the-process-exits-normally.patch b/bacula-stop-the-service-and-the-process-exits-normally.patch new file mode 100644 index 0000000..a025025 --- /dev/null +++ b/bacula-stop-the-service-and-the-process-exits-normally.patch @@ -0,0 +1,23 @@ +diff --git a/src/lib/signal.c b/src/lib/signal.c +index cdb9824..1712d25 100644 +--- a/src/lib/signal.c ++++ b/src/lib/signal.c +@@ -138,7 +138,7 @@ extern "C" void signal_handler(int sig) + already_dead++; + /* Don't use Emsg here as it may lock and thus block us */ + if (sig == SIGTERM || sig == SIGINT) { +- syslog(LOG_DAEMON|LOG_ERR, "Shutting down Bacula service: %s ...\n", my_name); ++ syslog(LOG_DAEMON|LOG_INFO, "Shutting down Bacula service: %s ...\n", my_name); + } else { + fprintf(stderr, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig)); + syslog(LOG_DAEMON|LOG_ERR, +@@ -274,6 +274,9 @@ extern "C" void signal_handler(int sig) + + } + #endif ++ if (sig == SIGTERM || sig == SIGINT) { ++ exit_handler(0); ++ } + exit_handler(sig); + Dmsg0(500, "Done exit_handler\n"); + } diff --git a/bacula.spec b/bacula.spec index 8be8187..1fd24b7 100644 --- a/bacula.spec +++ b/bacula.spec @@ -3,7 +3,7 @@ Name: bacula Version: 9.4.4 -Release: 3 +Release: 4 Summary: Cross platform network backup for Linux, Unix, Mac and Windows License: AGPLv3 with exceptions URL: http://www.bacula.org @@ -18,7 +18,7 @@ Source17: bacula-sd.sysconfig Patch0001: bacula-sqlite-priv.patch Patch0002: bacula-seg-fault.patch Patch0003: bacula-autoconf.patch - +Patch0004: bacula-stop-the-service-and-the-process-exits-normally.patch BuildRequires: desktop-file-utils perl-generators sed autoconf automake lzo-devel zlib-devel BuildRequires: gcc gcc-c++ glibc-devel ImageMagick libacl-devel libstdc++-devel libxml2-devel BuildRequires: libcap-devel ncurses-devel openssl-devel readline-devel sqlite-devel @@ -318,6 +318,9 @@ fi %{_mandir}/man* %changelog +* Mon Mar 8 2021 zhangjiapeng - 9.4.4-4 +- Stop the service and the process exits normally + * Mon Sep 14 2020 Ge Wang - 9.4.4-3 - Modify Source0 Url -- Gitee