diff --git a/src/dnode/src/dnodeSystem.c b/src/dnode/src/dnodeSystem.c index bdaecf2e0f211d8c63bc35037190d5c7392e77aa..3a50eca9e680b1a372f57ba2ef8673e924470d45 100644 --- a/src/dnode/src/dnodeSystem.c +++ b/src/dnode/src/dnodeSystem.c @@ -120,6 +120,7 @@ int32_t main(int32_t argc, char *argv[]) { taosSetSignal(SIGHUP, sigintHandler); taosSetSignal(SIGINT, sigintHandler); taosSetSignal(SIGABRT, sigintHandler); + taosSetSignal(SIGBREAK, sigintHandler); // Open /var/log/syslog file to record information. openlog("TDengine:", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_LOCAL1); @@ -152,12 +153,6 @@ static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 1 static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); } static void sigintHandler(int32_t signum) { - // clean the system. - dInfo("shut down signal is %d", signum); - - syslog(LOG_INFO, "Shut down signal is %d", signum); - syslog(LOG_INFO, "Shutting down TDengine service..."); - // protect the application from receive another signal taosIgnSignal(SIGUSR1); taosIgnSignal(SIGUSR2); @@ -165,6 +160,13 @@ static void sigintHandler(int32_t signum) { taosIgnSignal(SIGHUP); taosIgnSignal(SIGINT); taosIgnSignal(SIGABRT); + taosIgnSignal(SIGBREAK); + + // clean the system. + dInfo("shut down signal is %d", signum); + + syslog(LOG_INFO, "Shut down signal is %d", signum); + syslog(LOG_INFO, "Shutting down TDengine service..."); // inform main thread to exit tsem_post(&exitSem); diff --git a/src/os/inc/osSignal.h b/src/os/inc/osSignal.h index 8b047b9e258122b91f1462fc244c1e58a44997b1..57582a8a280ecbdc0b8a3dbdecacfdd0bce7a3cf 100644 --- a/src/os/inc/osSignal.h +++ b/src/os/inc/osSignal.h @@ -44,6 +44,10 @@ extern "C" { #define SIGUSR2 1234 #endif +#ifndef SIGBREAK + #define SIGBREAK 1234 +#endif + typedef void (*FSignalHandler)(int32_t signum); void taosSetSignal(int32_t signum, FSignalHandler sigfp); void taosIgnSignal(int32_t signum);