Stop the service and the process exits normally

(cherry picked from commit 95569bd8c04654013e2216b4fe1f99bae58c622e)
This commit is contained in:
jpzhang187 2021-03-08 15:29:47 +08:00 committed by openeuler-sync-bot
parent 21b73f6f94
commit 95194aea90
2 changed files with 28 additions and 2 deletions

View File

@ -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");
}

View File

@ -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 <zhangjiapeng9@huawei.com> - 9.4.4-4
- Stop the service and the process exits normally
* Mon Sep 14 2020 Ge Wang <wangge20@huawei.com> - 9.4.4-3
- Modify Source0 Url