bacula/bacula-stop-the-service-and-the-process-exits-normally.patch
jpzhang187 95194aea90 Stop the service and the process exits normally
(cherry picked from commit 95569bd8c04654013e2216b4fe1f99bae58c622e)
2021-03-09 09:47:53 +08:00

24 lines
843 B
Diff

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